Removing attributes of columns in data.frames on multilevel lists in R

前端 未结 6 556
太阳男子
太阳男子 2020-12-17 14:47

How do I remove the attributes of the following columns of data.frames on a nested list in R on the fly?

List of 1
 $ 0021400001:List of 19
   $ GameSumma         


        
6条回答
  •  没有蜡笔的小新
    2020-12-17 15:18

    You could write a function that works on one entry in the list, e.g.

    one_entry <- function(x) {
        for (i in length(x)) attr(x[[i]], "names") <- NULL
        return(x)
    }
    

    and then run lapply:

    lapply(my_list, FUN=one_entry)
    

    where mylist is the data structure in the question.

提交回复
热议问题