Questions Tagged [R]
Ask Question R Is a Free, Open-Source Programming Language & Software Environment for Statistical Computing, Bioinformatics, Visualization & General Computing...
R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible example(s) others can run using copy & paste. Show desired output. 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
452,735
questions
0
votes
1
answer
6
views
How to remove first set of numbers from column names in R?
I have column names, for example they look like this 20819830_r1ar_u_stationary and 2081974_f8ar_u. I am trying to get rid of the first set of numbers in the column names. I tried using this code
...
-1
votes
0
answers
10
views
Looping over a list of lists
I have a list of lists:
top_genes <- list("gene1" = gene1, "gene2" = gene2,
"gene3" = gene3, "gene4" = gene4,
"gene5" ...
0
votes
0
answers
6
views
ERROR in R - Train GBM Model -> Something is wrong; all the ROC metric values are missing:
I am attempting to train a "gbm" model in R with caret package. The scripts below shows the libraries I used and other details.
NOTE:
(1) My dataset has many features with NAs, but I do not ...
0
votes
0
answers
6
views
Autocorrelation Test
I am trying to run an Autocorrelation Test via R-Studio, I have come across the below code: acf(residuals, type="correlation")
I have tried to replicate this code by replacing the "...
0
votes
1
answer
12
views
How can I replace vector values with ascending numbers using the same intervals
I am trying to replace values of a vector with different intervals, such that the intervals are numbered from 1 to last interval. For example,
x <- c(5, 5, 5, 7, 7, 7, 9, 11, 11, 11, 15, 15, 15, 17,...
0
votes
0
answers
15
views
How to assign function inputs in map in R
I have a data frame of parameter values, in R, so for example
scenarios <- data.frame(max_day=c(100,200,300),max_cases=c(100,100,100),scale=c(2,3,2))
and I also have a function scenario_sim which ...
0
votes
0
answers
11
views
How to set working directory in newly created folder from R?
I set automatically the file location as path/working directory by this code:
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
Now I create new folder: "Data" and could you tell ...
0
votes
1
answer
15
views
How to remove NAs from a certain column in data frames in a list?
I have a list (my.list) that looks like this:
> my.list
$S1
A B C D
1 101027 NA C1 NA
2 101031 1.5 PTA 0.8666667
3 101032 1.4 C1 0.5571429
4 101127 NA PTA NA
5 ...
0
votes
0
answers
9
views
How to estimate the uplift (in revenue) of a loyalty program for different customer segments using Uplift Modeling (in R)?
I am currently working hard on my thesis about estimating the uplift of a loyalty program for a retailer, using uplift modeling (and comparing this to conventional modeling).
The main problem with my ...
0
votes
1
answer
22
views
Drop columns and order the data by a specific columns' names
I need help because I'm not skilled enough to accomplish that task.
I'm going to have several .csv files saved this way (with more and more rows):
ExamTitle ParametersName ...
0
votes
0
answers
9
views
Filter panel members that don't have before and after data
The context of my data is that I have (partial) time series data on the rental values for properties in a neighbourhood. A ‘treatment’ is a bank closing in the neighbourhood and I want to estimate the ...
0
votes
0
answers
16
views
Match only whole word, not partial word
I have a question regarding finding patterns in R
Simply,
files :
123.filt 123.filtered
files <-(pattern ="*.filt")
files now return both 123.filt and 123.filtered files.
I want ...
0
votes
1
answer
12
views
Finding a column name which bears the same name as a row value then change row values from that column onwards to NAs
I have a big data frame, one of the columns have levels which bears same values as the column names( e.g df[1,3]= 22/05/2020, has the same value as column 4, = 22/05/2020. I want to replace values ...
0
votes
0
answers
6
views
Grouping predictors with msgl package
I would like to perform multinomial group lasso for variable selection, so I was suggested to use the msgl package. I have an outcome variable with 4 categories and 40 potential categorical predictor. ...
0
votes
1
answer
16
views
Removing very similar Tweets in R
I am preprocessing tweets scraped using Twitter API in R and I have noticed that significant chunk of the tweets are basically duplicates with some minimal variation. In example: "zero knowledge ...