문제

The string is enter image description here And I want to get substrings "11","1.1","282". Can anyone show me how to do this in R? Thanks!

올바른 솔루션이 없습니다

다른 팁

I believe strsplit(x," +")[[1]] will do it. (the regular expression " +" denotes one or more spaces; strsplit applies to character vectors, and returns a list with the splitted version of each element in the vector, so [[1]] extracts the first (and only) component)

> x = "11  1.1     282"
> res <- strsplit(x, " +")
> res
[[1]]
[1] "11"  "1.1" "282"

> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top