introR icon indicating copy to clipboard operation
introR copied to clipboard

“将 case 列拆分为两列, 并删除原列”与“tstrsplit(DT$rate, split = "/")][, rate := NULL]”中的字符,似乎没有统一符号

Open shenjian5 opened this issue 2 years ago • 0 comments

感谢张老师对R语言资料的分享。张老师的R语言书籍,总结了常用的知识点和技巧,真的是良心之作。

ps: 书本2.7节(第200页),预计是笔误了(“将 case 列拆分为两列, 并删除原列”与“tstrsplit(DT$rate, split = "/")][, rate := NULL]”中的字符,似乎没有统一符号)。

DT = as.data.table(table3)

将 case 列拆分为两列, 并删除原列

DT[, c("cases", "population") := tstrsplit(DT$rate, split = "/")][, rate := NULL]

shenjian5 avatar Jun 22 '22 13:06 shenjian5