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.
文字列は 、部分文字列「11」、「1.1」、「282」を取得したいです。Rでこれを行う方法を誰かに教えてもらえますか? ありがとう!
私はstrsplit(x," +")[[1]]それを行うと信じています。(正規表現" +"は 1 つ以上のスペースを示します。strsplit文字ベクトルに適用され、ベクトル内の各要素の分割バージョンを含むリストを返すため[[1]]、最初の (そして唯一の) コンポーネントを抽出します)
strsplit(x," +")[[1]]
" +"
strsplit
[[1]]
> x = "11 1.1 282" > res <- strsplit(x, " +") > res [[1]] [1] "11" "1.1" "282" >