創建的分割化矢量的列表有了這樣例子的代碼:ř由索引
set.seed(11)
x <- sample(letters)
x
[1] "h" "a" "m" "y" "b" "u" "v" "f" "p" "c" "q" "g" "x" "l" "i" "o" "e" "r" "t" "d" "z" "k" "s" "j" "w" "n"
並設置有值的這種載體
y <- c(4, 13, 20)
我想通過分裂x
矢量向上y
矢量作爲「切片」索引。並將結果分組爲列表。期望的輸出:
z <- list(c("h", "a", "m", "y"),c("b", "u", "v", "f", "p", "c", "q", "g", "x"), c("l", "i", "o", "e", "r", "t", "d"), c("z", "k", "s", "j", "w", "n"))
z
[[1]]
[1] "h" "a" "m" "y"
[[2]]
[1] "b" "u" "v" "f" "p" "c" "q" "g" "x"
[[3]]
[1] "l" "i" "o" "e" "r" "t" "d"
[[4]]
[1] "z" "k" "s" "j" "w" "n"
@AlexA。謝謝你會添加一些 – akrun