Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 R 中有一个数据框,其中日期是列之一
head(t) # date x #2013-04-05 32851 #2013-04-06 42523 #...
我需要解析 date 并 get 20130405,20130506作为同一数据框中的另一列。我该怎么做呢 ?
20130405
20130506
怎么样gsub...
gsub
df$new <- gsub( "-" , "" , df$date ) date x new 1 2013-04-05 32851 20130405 2 2013-04-06 42523 20130406