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.
我有以下字符串:
> position_string [1] "35.132 46.524 94.997"
如何获得 35.132、46.524、94.997 作为列表?在 python 中,我会做 string.split() 就是这样,但我似乎无法开始strsplit工作。
strsplit
怎么样
position_string <- "35.132 46.524 94.997" lapply(unlist(strsplit(position_string," +")),as.numeric)
? 正则表达式" +"处理多个空格。(我假设您想将块转换为数字,但也许您不想......)
" +"
PS你真的想要输出作为一个列表,还是实际上作为一个向量?