Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

r apply functions over list of data frames

For the first required apply this

dflist <- lapply(dflist, function(x) {
    names(x) <- ifelse(startsWith(names(x), "Q"), 
    gsub("[Q_0-9]+", "" , names(x)), names(x))
    x})
and the second
col_keep <- c("ID", "Period", "subjects", "A", "B")
dflist <- lapply(dflist, function(x) subset(x , select = col_keep))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #apply #functions #list #data #frames
ADD COMMENT
Topic
Name
3+5 =