Multiple Separators for the same file input R

后端 未结 3 1159
一个人的身影
一个人的身影 2020-12-30 08:17

I\'ve had a look for answers, but have only found things referring to C or C#. I realise that much of R is written in C but my knowledge of it is non-existent. I am also re

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 08:18

    I find the functions in package splitstackshape convenient in cases like this.

    library(splitstackshape)
    
    # split concatenated column by `_`
    results2 <- concat.split(data = results, split.col = "V3", sep = "_", drop = TRUE)
    
    # split the remaining concatenated part by `-`
    results3 <- concat.split(data = results2, split.col = "V3_5", sep = "-", drop = TRUE)
    results3
    

提交回复
热议问题