我将拆分一个字符串,该字符串由如下所示的数据组成: 105/44(64)我将将其拆分为3列:
"diastole"
我怎么能这么做?我没有足够的能力把关于分裂字符串的其他问题.我想我得用弦乐来做这事?
发布于 2022-01-24 17:59:03
在base R中,我们可以在创建公共分隔符之后使用read.csv/read.table。
read.csv(text = trimws(gsub("[[:punct:]]", ",", str1), whitespace= ","),
header = FALSE, col.names = c("systole", "diastole", "map"))-output
systole diastole map
1 105 44 64
2 106 43 61数据
str1 <- c('105/44(64)', '106/43(61)')https://stackoverflow.com/questions/70830237
复制相似问题