[英]Select and import dataframes into a list from the global environment
I would like to select and import ca. 我想选择并导入ca。 30 dataframes from my global environment into a list.
我的全球环境中的30个数据框成一个列表。 All my dataframes end with ".AM", therefore should be very easy to import them but I am still quite new to R.
我所有的数据框都以“ .AM”结尾,因此导入它们应该非常容易,但是对于R我还是很陌生。
I tried: 我试过了:
mylist <- list(pattern = "*.AM")
but it doesn't work. 但这不起作用。
我们可以使用mget
返回list
的数据集。
mget(ls(pattern = "*.AM"))
you are looking for 你在找
mylist <- ls(pattern = ".AM")
which returns mylist
as a vector of the matching object names 返回
mylist
作为匹配对象名称的向量
try to set the working directory to wherever the files are saved 尝试将工作目录设置为保存文件的位置
setwd("C:\\user\\files")
then create a list of the .AM dataframes 然后创建.AM数据帧的列表
mylist = list.files(pattern="*.AM")
I guess that should work? 我想应该行吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.