I'm preparing data frames for analysis in R. I can prepare them separately correctly but I want to place the preparation in a for loop (or apply
/lapply
?) for obvious reasons.
The initial code is like this(which works per data frame), where indHab
is a data frame:
indHabO <- indHab[complete.cases(indHab),]
row.names(indHabO) <- indHabO$Location
indHabO[1] <- NULL
indHabOK <- indHabO[,colSums(indHabO) > 0.1]
I tried a for loop but I got stuck. Only thing I know is that it was sensible to place all data frames in a list, like this before attempting a loop of some sort:
dataSets <- list(indHab, indLoc, famHab, famLoc, indicatorHab_2012,
indicatorHab_2018, indicatorLoc_2012, indicatorLoc_2018)
How do I loop the operations over all data frames in the list?