我在 R 环境中有一系列不同长度的向量,例如:
> s_aleat_0
[1] "12M08393" "12M08427" "12M08412" "12M08441" "12M08436" "12M08444" "12M08443" "12M08387"
> s_aleat_1
[1] "12M08405" "12M08389" "12M08439" "12M08406" "12M08397" "12M08402"
> s_aleat_2
[1] "12M08422" "12M08441" "12M08410" "12M08391" "12M08396" "12M08420" "12M08409"
我想通过模式将它们调用到另一个函数中(rbind 他的字符串以将初始向量加入更大的向量中),如下所示:
samples<-ls(pattern = "s_aleat_")
unique(c(rbind(samples)))
[1] "12M08393" "12M08405" "12M08422" "12M08427" "12M08389" "12M08441" "12M08412" "12M08439" "12M08410"
[10] "12M08406" "12M08391" "12M08436" "12M08397" "12M08396" "12M08444" "12M08402" "12M08420" "12M08443"
[19] "12M08409" "12M08387"
但是当我将“样本”放入 rbind 时,它无法识别向量,如果不是使用 ls 函数获得的文本,如下所示:
c(rbind(samples))
[1] "s_aleat_0" "s_aleat_1" "s_aleat_2" "s_aleat_4" "s_aleat_5"
我怎么能修好它?