I have the following string:
> position_string
[1] "35.132 46.524 94.997"
How do I just get 35.132, 46.524, 94.997 as a list? In python I would do string.split() and that’s it but I can’t seem to get strsplit to work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about
? The regular expression
" +"takes care of multiple spaces. (I’m assuming you want to convert the chunks to numeric, but maybe you don’t …)PS do you really want the output as a list, or actually as a vector?