R 如何从字符串中提取数据帧? Table1

R 如何从字符串中提取数据帧? Table1,r,R,如果您确实需要,请列出您的表: Table1 <- read.csv("table1.csv", header = T, sep = ",") Table2 <- read.csv("table2.csv", header = T, sep = ",") Table3 <- read.csv("table3.csv", header = T, sep = ",") Table4 <- read.csv("table4.csv", header = T, sep = ","

如果您确实需要,请列出您的表:

Table1 <- read.csv("table1.csv", header = T, sep = ",")
Table2 <- read.csv("table2.csv", header = T, sep = ",")
Table3 <- read.csv("table3.csv", header = T, sep = ",")
Table4 <- read.csv("table4.csv", header = T, sep = ",")
tables <- c("Table1", "Table2", "Table3", "Table4")
tables
[1] "Table1" "Table2" "Table3" "Table4"
tables[2]
[1] "Table2"
您所做的是创建字符串向量,其中字符串是“Table1”、“Table2”等,而不是存储表对象。

  • 我想你需要的可能是下面这样的东西
从全局环境中获取对象
表2

  • 如果将所有对象保存到名为
    tables
    的列表中,即
表格同样,您的行
表格
tables <- list(Table1, Table2, Table3, Table4)
tables[[1]]
get(tables[2])
tables <- list(Table1, Table2, Table3, Table4)