data.frame 实际上是一个列表。你只需要删除类。
mylist <- list(df1=data.frame(a=1:10, b=11:20),df2=data.frame(a=c("a","b"), b=c("c","d")))
str(mylist)
# List of 2
# $ df1:'data.frame': 10 obs. of 2 variables:
# ..$ a: int [1:10] 1 2 3 4 5 6 7 8 9 10
# ..$ b: int [1:10] 11 12 13 14 15 16 17 18 19 20
# $ df2:'data.frame': 2 obs. of 2 variables:
# ..$ a: Factor w/ 2 levels "a","b": 1 2
# ..$ b: Factor w/ 2 levels "c","d": 1 2
mylist2 <- lapply(mylist, unclass)
str(mylist2)
# List of 2
# $ df1:List of 2
# ..$ a: int [1:10] 1 2 3 4 5 6 7 8 9 10
# ..$ b: int [1:10] 11 12 13 14 15 16 17 18 19 20
# ..- attr(*, "row.names")= int [1:10] 1 2 3 4 5 6 7 8 9 10
# $ df2:List of 2
# ..$ a: Factor w/ 2 levels "a","b": 1 2
# ..$ b: Factor w/ 2 levels "c","d": 1 2
# ..- attr(*, "row.names")= int [1:2] 1 2