2017-07-26 6 views

答えて

1

あなたはstringrパッケージを使用することができるように、言葉をマークのみを返すための最良の機能をある何

x = as.character("If you do not 'answer' this question, 'two' persons will 'die' in the next second") 

library(stringr) 
y <- str_match_all(x,"\\'([^\\s]+)\\'")[[1]][,2] 

y 
[1] "answer" "two" "die" 

ベクトルxに適用する場合、str_match_allは2列のリストを生成しますn個の要素のそれぞれについて、N個の行列を計算する。それぞれの第2列が必要です。

関連する問題