将字符列表合并为一个

时间:2017-12-01 18:54:32

标签: r list

我正在尝试将一系列字符列表合并到一个文件中,但无法弄清楚如何操作。我在下面解释我的代码:

也许这是一个以组合字符列表为主题的问题。不幸的是,我仍然不知道该怎么做。我们将非常感谢您的帮助。

num = c(1:5)
aa = paste0(names, "class.", num)   ##read all 5 files, naming class.1, etc
aa = sapply(aa, scan, what = "character", quiet = T) ## scaning them into one list
class(aa) # its class is list
class(aa[[1]]) # this time, the class is character

## I tried to combine aa into one single file in the following step, 
## but it did not work well. Maybe a single file is not accurate, 
##but I hope this ‘file’ has the length of the sum of all above 5 files. 

all = rbind(aa, deparse.level = 0) 
## it gives the exactly same result as aa gives. The length of all is equal to 5

0 个答案:

没有答案