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出力をリストとして、または実際にベクトルとして本当に必要ですか?