Skip to main content
The 2024 Developer Survey results are live! See the results

R Language Collective

Questions

Browse questions with relevant R Language tags

514,067 questions

0 votes
0 answers
8 views

aggregation based upon multiple criteria and time range (R)

Ultimately, I want to aggregate the amount column in my data over modular groups that do not yet exist but that are the composite of two existing groups and a time difference dimension. I have a ...
Grum's user avatar
  • 25
0 votes
0 answers
7 views

Which versions to install to make RandomFields, RandomFieldsUtils, rpy2 compatible?

I am hoping to install some packages that people no longer update. I need RandomFields (https://cran.r-project.org/src/contrib/Archive/RandomFields/), RandomFieldsUtils (https://cran.r-project.org/src/...
Sasha Queequeg's user avatar
0 votes
2 answers
20 views

Why is this part of my code not adding the new columns to my data frame?

I have 13 datasets that are in .XPT format called data2010, data2011, data2012.. data2022. These are the BRFSS datasets from the CDC website. I have been trying to add three new columns to each of my ...
Jalinne's user avatar
0 votes
0 answers
16 views

Is there an R program that plot ROC curve nicely?

Is there any package that allows me to plot ROC curve like this? ? The 0.95,0.9 are particular threshold values. I tried the package verification with roc.plot(truth,v,xlab="FDR",ylab="...
monotonic's user avatar
  • 580
1 vote
0 answers
25 views

How can I append duplicated groups of a dataset with changes to existing data in R efficiently?

I have data like this: key_data <- data.frame(orig_letter=c("A","A","A","A","C","C","F","B","B","B&...
Neal Barsch's user avatar
  • 2,910
0 votes
0 answers
11 views

Capture legend event shiny echarts4r

Is it possible to capture a legend activation / deactivation event of a echart in RStudio using a shiny app? mtcars |> head() |> tibble::rownames_to_column("model") |> e_charts(...
user26514262's user avatar
1 vote
1 answer
9 views

leaflet() empty geometry Error Don't know how to get polygon data from object of class XY,GEOMETRYCOLLECTION,sfg

I was using the leaflet package in R, and I had this error (in the title) that took some time to track down. I could not find the exact error or solution posted, so I am posting. I was using a ...
Marty May's user avatar
0 votes
1 answer
32 views

move inset plot legend

I have an inset plot with a legend that I want to be shown at the bottom of the overall figure. This legend isn't the same for the larger plot, since I added more layers to the inset plot. How can I ...
awray's user avatar
  • 17
0 votes
0 answers
16 views

'Maximum call stack size exceeded' when using tsibble::fill_gaps() in a shinylive webr app

I am using shinylive (v0.2.0) to write a Shiny (v1.8.1.1) app to run in the browser (Safari v17.5, 19618.2.12.11.6) using webr. The app takes data where each row represents an event and counts the ...
Matt Ashby's user avatar
1 vote
0 answers
28 views

Combine event binding and dynamic outputs in shiny

My Shiny app consists of selecting a set of parameters to generate outputs based on the corresponding data, where each parameter is dependent on the previous one to narrow down which data needs to be ...
yben's user avatar
  • 53
0 votes
0 answers
38 views

Element does not exist in dataset when selected via selectInput

In the shiny app below I try to group by selected input but I get: Caused by error in `all_of()`: ! Can't subset elements that don't exist. ✖ Element `abs_edu` doesn't exist. This is my code: library(...
firmo23's user avatar
  • 8,276
0 votes
0 answers
37 views

Problem with dynamic linear model -> lagged variable explains 100% of my model

I created a regression model, which regresses a cycle component onto a lagged cycle component and various other variables. It looks like this: regoffice4 <- dynlm( diff(diff(officecycle,1),1) ~ ...
Alexander Holzinger's user avatar
0 votes
0 answers
41 views

Create a function that converts a dataframe into a format suitable for a treemap structure

I want to create a treemap for a dataframe using the Plotly package. For this purpose, I need to create a function that converts the dataframe into a format suitable for a treemap structure. On the ...
Masoud's user avatar
  • 565
0 votes
0 answers
18 views

ggplot line plots are not showing up on proportional secondary axis

I am trying to plot a barplot, and overlay some plots onto it using a secondary axis. I am able to adjust the secondary axis to be proportional to the values but the line plots still seem be squished ...
no_frills_30's user avatar
0 votes
1 answer
19 views

How to adjust x axis in coefficient plot with sjPlot's plot_model when x value range is smaller than -1,1?

I'm plotting multiple regression coefficients with plot_model and the x axis is automatically set to -1,1 even though the possible range of my values is smaller, which makes the estimates hard to see ...
kommoder_Waran's user avatar
1 vote
1 answer
19 views

as.ggplot in dendextend does not leave enough room for leaf labels

I've been using ggplot2 for automated report generation, and had been using ggdendro for accompanying dendrograms. However, as ggdendro seem to no longer be actively supported and I encountered this ...
Ben Wright's user avatar
2 votes
2 answers
42 views

Ploting weekly data with base::plot with unique and evenly spaced labels

I am trying to create a simple scatter plot, so weeks on the x-axis and "cases" on the y with each indicated by a dot and note I can only use base R's plot(), no ggplot. I have data with 156 ...
Fable's user avatar
  • 57
-1 votes
0 answers
10 views

Regression tree's predicted results interpretation for type = "vector" in R [closed]

I am using rpart to build a CART model (method = "anova") and predict.rpart with type = "vector to make a prediction. I understand that that way is building a regression tree, but I ...
Phoebe's user avatar
  • 109
-1 votes
2 answers
45 views

R, ggplot2 - time on x axis

In R I have a data frame with bid and ask prices for a single day. Here is an example: TimeHM; Bid_Price1; Ask_Price1 08:12; 101; 102 08:13; 101; 102 08:14; 102; 104 ... 17:05; 104; 105 So, each new ...
Avocado's user avatar
  • 84
0 votes
0 answers
26 views

Indicator Species Analysis Long Run Time [closed]

I am using the indicspecies R package to run an indicator species analysis on a large dataset to see what species are indicators for 3 different regions over the years 2001 to 2021. My matrix is ~550 ...
mp101's user avatar
  • 3
0 votes
1 answer
32 views

R package: equation not rendered in helper files of function of html pages

I am building a package and an associated website (via Github Pages). Let say I have a function funX. In R, when I do ?funXI have some equations (using \eqn{} or \deqn{}) in the description files, and ...
G. Ander's user avatar
  • 304
-1 votes
1 answer
29 views

How to change the background color of a Datatable header using css?

My question is similar to this question, except that I would like to use a css rule in an external css file.
Edd's user avatar
  • 85
6 votes
2 answers
92 views

How to capture install.packages output in R with sink()?

I'd like to capture all output and errors when installing a packages. The steps when installing a package, however, do not seem to be captured by the sink() command. Here's an example: A main.R file: ...
Brian Albert Monroe's user avatar
0 votes
0 answers
19 views

R shiny app - rendering is much slower when run on remote server compared to local server

I made an R shiny app which runs perfectly in my local browser on my local server, however the rendering is noticeably slower when I run the same app from my local browser on a remote server. A quick ...
Þórhildur Júlíusdóttir's user avatar
3 votes
1 answer
39 views

Keep ggplot font size constant in different figure dimensions

I'm in a position that requires me to frequently change the dimensions of my plots via the fig.dim=c(...,...) option in each r chunk. However, I have a problem that I haven't been able to solve yet. ...
Coppertank's user avatar
0 votes
0 answers
22 views

Issue with Residual Plot Pattern after Fitting beta_family Model in glmmTMB

I'm working with proportion data and have tried several models to address issues of overdispersion and underdispersion. Initially, I used a binomial distribution model which showed overdispersion. ...
KSN2's user avatar
  • 1
0 votes
0 answers
10 views

Grab the user details when a user authenticates an R shiny web app using Azure Active Directory

I am new to the concept of web apps deployed in Azure and related authentications. I have an R Shiny app, hosted as an app service in Azure cloud using Docker containers. I have few Azure user groups ...
Moohoo's user avatar
  • 9
0 votes
0 answers
26 views

Merging PISA 2000 student file with ESCS index file [duplicate]

I am using PISA data from 2000, 2003 & 2018. I am using the ESCS index. For 2000, the ESCS index is not included in the student file and has to be merged with the student file. However, I load ...
user26513034's user avatar
0 votes
1 answer
39 views

Table disappearing if inputting special characters [closed]

I am using reactable with custom filtering and regular expression patterns, like in this example: https://glin.github.io/reactable/articles/custom-filtering.html#regular-expression-pattern-filtering ...
userq8957289475's user avatar
0 votes
0 answers
11 views

Error when using diagnose function from glmmTMB

I'm using glmmTMB (version 1.1.9) to run a step selection analysis with the two-step approach suggested by Muff et al. 2020 (fitting a Poisson model specifying a stratum-specific fixed intercept) ...
Benedikt Gehr's user avatar
1 vote
5 answers
87 views

How to count the total entries by group when they are comma-separated

I'm working with the League of Legends Champions dataset name tags Aatrox Fighter Ahri Mage,Assassin Akali Assassin Akshan Marksman,Assassin Alistar Tank,Support And I was wondering how to ...
Hiram Méndez's user avatar
1 vote
1 answer
41 views

Creating a large number of columns in R tidyverse based on a comparison with a specific column

I have a dataset in R tidyverse and I want to create 192 columns based on comparison with the sp column, just like the mp_comp_1 column. How can I do this for 192 columns in tidyverse? library(...
Hamideh's user avatar
  • 697
-1 votes
0 answers
56 views

Interpunct (middle dot) in R [closed]

What is the meaning of an interpunct (middle dot, https://en.wikipedia.org/wiki/Interpunct) in R? After some troubleshooting with column names that were thought to be identical across dataframes but ...
Martin's user avatar
  • 592
1 vote
1 answer
20 views

How to Add Significance bars a Bar Plot that have percentage/logical data

I have a dataframe with a categorical variable and a few logical variables. I’ve created an example using the iris dataset: # Create a new dataframe showing the percentage each variable that is ...
katkat's user avatar
  • 11
0 votes
0 answers
47 views

Why Does Native Pipe Operator |> Fail with Placeholder _ in R? [duplicate]

I am trying to compare the %>% with the native |>, but I am not too sure why sometimes it only works for %>%. Here is an example: library(magrittr) library(stringr) # Create the sample ...
Grasshopper_NZ's user avatar
1 vote
2 answers
51 views

Pattern matching in a dataframe

I am having some trouble conducting pattern matching within a data frame. I am working with grepl function in R. I have a data frame of 5 local districts in two years (2001 and 2002). I want to check ...
YouLocalRUser's user avatar
1 vote
6 answers
57 views

Divide one column to three add fill up missing numbers

That's a part of my data: structure(list(Testa = c(-1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L), Pre = c(NaN, NaN, NaN, ...
Shaxi Liver's user avatar
  • 1,100
0 votes
1 answer
17 views

How to validate multivariate linear model using split half analysis or cross validation? [closed]

I created a multivariate linear model and am wondering how I can validate the model? The samples are environmental samples and due to a few limitations I am not able to validate by collecting more ...
Robyn O'Halloran's user avatar
0 votes
1 answer
24 views

Trying to make a heatmap based on percentage values from zip code area [closed]

I've been trying to use the choroplethrZip package to do this based on a previous post, but my version of R will not support this package. I'm using the data set and code below, and believe I have it ...
Preston Carey's user avatar
0 votes
1 answer
17 views

Direct input elements in shinydashboard sidebar

I was wondering if I could modify the following shiny app and put the sliderInput into the sidebar section : library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "DB manager&...
Haribo's user avatar
  • 2,154
0 votes
1 answer
16 views

Calculate the predicted probabilities for each class using rpart in R

I am new to use rpart to build CART models. I wonder if the following code is printing the predicted probabilities of each class value = 1 in predictions. And pred_class saves the predicted class (...
Phoebe's user avatar
  • 109
0 votes
1 answer
29 views

How to put a ggplot into a Word doc using Officer in R?

I am attempting to use bookmarks in Word to automatically place plots into a report. I have already used "body_replace_flextable_at_bkm" to add flextables automatically, however I cannot ...
MLBPhillies26's user avatar
0 votes
1 answer
34 views

R Reference Class Add New Variable by Name

Consider the following R code : MyClass <- setRefClass("MyClass", fields = list( ), methods = list( initialize = function(x){ #give new attribute x ...
温泽海's user avatar
  • 344
1 vote
3 answers
49 views

Filter function in Base R

I was curious about methods to return duplicate values in a vector, list, or array in R. Focusing on a vector, I defined the following: myvec <- c('a', letters) which duplicates the letter 'a' in ...
AdamO's user avatar
  • 4,870
0 votes
0 answers
55 views

Dealing with duplicate rows when creating a visit column, cartesian multiplication

I'm having trouble with data transformation. What I want to do is go from a data table that created Cartesian multiplications to one that is sorted by column of visit number. The logic: this is a ...
Gal Or's user avatar
  • 1
0 votes
1 answer
20 views

mlrMBO Error in validObject(model, complete = TRUE)

I'm trying to recreate the example from here using my data, but I'm getting an error x <- structure(list(`1` = c(0L, 0L, 0L, 0L, 0L), `2` = c(0L, 0L, 0L, 0L, 0L), ...
mr.T's user avatar
  • 598
0 votes
1 answer
18 views

Extract stock market data from yahoo finance

I need to extract the symbols from the stocks that appear in this platform: https://finance.yahoo.com/markets/stocks/most-active/?start=0&count=100 I'm using R to achieve the aforthmentioned using ...
HMC's user avatar
  • 1
0 votes
0 answers
22 views

Using R or Python script to display an org chart in PowerBI [closed]

I am trying to build an org chart in powerBI using R or Python script, because my database is over 10000 lines. My csv database has employeeID, ManagerID, employee name and job position. So, the help ...
TC999's user avatar
  • 1
0 votes
0 answers
17 views

Multilevelannotation function error in xMSannotator package. Error in hclust() NA/NaN/Inf

I have been trying to use the multilevelannotation function within the xMSannotator package to process mass spectrometry data. This package can be accessed through using: install.packages(c('...
TCB at EU's user avatar
  • 131
0 votes
0 answers
28 views

Changing label colors in gge plot

I'm trying to change the color of the labels and it seems that the input of vector of colors works for lines and not for labels and the label color is just the first color of the vector list. Maybe ...
Artūrs Katamadze's user avatar


15 30 50 per page
1
2 3 4 5
10282