Questions tagged [r]
R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.
326
questions
2
votes
1
answer
76
views
lme4 (glmer): Something buggy with treatment of factors in 4-way interactions
I have a dataset for which I am making a series of complex generalized linear mixed-effects models with the lme4 package in R. I have experience with glmer and this type of experimental data, but I'...
0
votes
1
answer
21
views
how can I force the scale in ggplot to be in the middle of the data range?
In the plot below, the range in a goes from 0.001 to 0.7 but the legend doesn't have the middle value in the cyan color. Is there a way I can force that the middle value in the range of a be in the ...
0
votes
0
answers
12
views
How to change the line-height only in the code chunk when using Rmd in Rstudio
I'm looking for a way to modify the .rstheme file and adjust the line-height in a R markdown document. Specifically I want the code chunk in the Rmd file to have a line-height of 1.2 and for the other ...
3
votes
0
answers
25
views
R parallel: Stopping a cluster you don't have the object for?
I am working with a function that starts with parallel::makeCluster() and ends with parallel::stopCluster(). Sometimes it crashes in the middle and does not stop the cluster.
Demonstration code:
...
0
votes
0
answers
28
views
How to remove real-time NA rows?
I'm writing a code in shiny to input data in real time and download a csv file, but I want to remove rows with NA in the final output file.
Is it difficult to remove rows in real time in shiny?
Is it ...
0
votes
0
answers
11
views
RStudio: Failure to install 'imager'
I am attempting to do the tutortial "Getting started with imager", but the very first instruction library(imager) generates a long error message, with only the first part shown below
Error: ...
1
vote
1
answer
31
views
Fix order of stacks but allow colour to change
The data and code for this question were adapted from:
How to fill colors of stacked bar plot depending on colors column of df in R using ggplot
I want to fix the order of country appearance in each ...
-1
votes
0
answers
37
views
Exact same line of code not working between 2 PCs [closed]
On my home PC with R4.4.0
avg_demand_per_yearday <- aggregate(demand ~ yearday, df, 'mean')
it works as expexted. On my work machine with R4.4.1 an error occurs
Error in UseMethod("aggregate&...
1
vote
2
answers
57
views
Efficiently standardize a large matrix in R with foreach/doParallel?
I need to standardize (subtract the mean and divide by the standard deviation) the columns of several large matrices in R (roughly 300,000 rows by 10,000-20,000 columns).
The process has been very ...
0
votes
0
answers
22
views
Issues in my script to analyze a list of stock ticker symbols
The purpose of this script is to gather basic information about all S&P listed stocks from Wikipedia. It then uses the get symbol to extract price data over time, calculates log.return over that ...
0
votes
0
answers
13
views
Error in system(cmd, intern = intern, ignore.stdout = ignore.stdout, ignore.stderr = ignore.stderr)
I am running an R script that uses cifti and am getting this error:
Error in system(cmd, intern = intern, ignore.stdout = ignore.stdout, ignore.stderr = ignore.stderr) :
error in running command
...
0
votes
0
answers
55
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 ...
0
votes
0
answers
10
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/...
0
votes
2
answers
40
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 ...
-1
votes
0
answers
28
views
Is there an R program that plot ROC curve nicely? [closed]
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="...