I have a list of dataframes and am currently using the following for loop:
for (i in 1:length(genotypeGOI)){
genotypeGOI[[i]]$SEQSTRAND <- '*'
}
But I'd really like to learn how to use lapply properly.
I've tried many different options using the mutate function but nothing is giving me what I want. My latest attempt is:
genotypeGOI <- lapply(X = genotypeGOI, FUN = function(x){
x <- x$SEQSTRAND, '*')
})
But this is giving me an error:
Error: unexpected ',' in:
"genotypeGOI <- lapply(X = genotypeGOI, FUN = function(x){
x <- x$SEQSTRAND,"
Basically I would like to know how to change the values in a specific column for each dataframe in a list using lapply and don't really care about this specific problem.
I've looked at the other posted questions related to this and the most similar one says to make a function and to call that in lapply but I really don't want to do that for a one-liner.
Thanks