Split data.frame into groups by column name

后端 未结 2 1914
我寻月下人不归
我寻月下人不归 2020-12-17 03:15

I\'m new to R. I have a data frame with column names of such type:

file_001   file_002   block_001   block_002   red_001   red_002 ....etc\'  
  0.05                


        
2条回答
  •  温柔的废话
    2020-12-17 03:50

    Thank you lmo, after using your code, it didn't work as I wanted, but I came with a solution thanks to your guidance.

    So, in order to divide a Data Frame list:

    myDfList <- split.default(dat, sub(x = as.character(names(dat)), pattern = "\\_.*", ""))
    

    hope it'll help people in the future!

提交回复
热议问题