Use lapply to go through a list of dataframes and change class of specific column
问题 I'm trying to go through a list that has two data frames and I want to change the class of column 2 from factor to data in each of those data frames. I can solve this with a for loop, but I want to learn how to do this with lapply. tom <- data.frame(a = c(1,2,3), b = c("2017-01-09","2017-01-10","2017-09-11")) kate <- data.frame(a = c(4,5,6), b = c("2017-01-09","2017-01-10","2017-09-11")) testList <- list(tom,kate) f <- lapply(testList, function(x) { x[,2] <- as.Date(x[,2]) }) I'm looking for