だから私はdata.frameを持っています
dat = data.frame(x = c('Sir Lancelot the Brave', 'King Arthur',
'The Black Knight', 'The Rabbit'), stringsAsFactors=F)
> dat
x
1 Sir Lancelot the Brave
2 King Arthur
3 The Black Knight
4 The Rabbit
そしてそれをデータフレームに変換したい
> dat2
x 1 2 3 4
1 Sir Lancelot the Brave Sir Lancelot the Brave
2 King Arthur King Arthur
3 The Black Knight The Black Knight
4 The Rabbit The Rabbit
strsplitはデータをリストとして返します
sbt <- strsplit(dat$x, " ")
> sbt
[[1]]
[1] "Sir" "Lancelot" "the" "Brave"
[[2]]
[1] "King" "Arthur"
[[3]]
[1] "The" "Black" "Knight"
[[4]]
[1] "The" "Rabbit"
また、as.data.tableは必要な場所にNULL値を作成しませんが、値を繰り返します
> t(as.data.table(sbt))
[,1] [,2] [,3] [,4]
V1 "Sir" "Lancelot" "the" "Brave"
V2 "King" "Arthur" "King" "Arthur"
V3 "The" "Black" "Knight" "The"
V4 "The" "Rabbit" "The" "Rabbit"
as.data.table(x、repeat = FALSE)の引数が本当に必要だと思います。それ以外の場合、このジョブを実行するにはどうすればよいですか?