我有一列在]中>
cell.1是“ UNIV ZURICH;未报告;未报告;未报告”cell.2是“ UNIBG”
s = c("UNIV ZURICH;NOTREPORTED;NOTREPORTED;NOTREPORTED", "UNIBG") s1 = unlist(strsplit(s, split=';', fixed=TRUE))[1] s1
我想得到
cell.1 UNIV ZURICH cell.2 UNIBG
非常感谢,
[我有一列,其中cell.1是“ UNIV ZURICH; NOTREPORTED; NOTREPORTED; NOTREPORTED” cell.2是“ UNIBG” s = c(“ UNIV ZURICH; NOTREPORTED; NOTREPORTED; NOTREPORTED”,“ UNIBG”)s1 =取消列出(strsplit(s,...
s = c("UNIV ZURICH;NOTREPORTED;NOTREPORTED;NOTREPORTED", "UNIBG")
s1 = strsplit(s, split=';')
result = data.frame(mycol = unlist(lapply(s1, function(x){x[1]})))
> result
mycol
1 UNIV ZURICH
2 UNIBG
您的strplit
方法是一个好主意: