简体   繁体   English

linux(ubuntu)如何在多个.RData中找到特定的对象(数据)?

[英]How can I find specific object(data) in mutiple .RData by linux(ubuntu)?

I would like to find specific object (data) in the mutiple .RData by linux (Ubuntu). 我想在Linux(Ubuntu)的多个.RData中找到特定的对象(数据)。

For example, I have some of .RData, and I want to find object name include "max" (so... max_1, max_2, ... in the .RData). 例如,我有一些.RData,并且我想查找对象名称包括“ max”(因此,.RData中的max_1,max_2,...)。

As I had no idea what the RData has specific object (data), I want to check multiple .RData whether .RData has a certain object (data). 由于我不知道RData有特定的对象(数据),因此我想检查多个.RData是否.RData具有特定的对象(数据)。

Moreover, I want to do this in the linux (Ubuntu) environment. 此外,我想在linux(Ubuntu)环境中执行此操作。

Please let me know how to do this. 请让我知道该怎么做。

Thank you advanced. 谢谢高级。

Maybe try this in R console. 也许在R控制台中尝试一下。 This will give you all the available object whose names starts with "max". 这将为您提供名称以“ max”开头的所有可用对象。

files <- dir()
rdata_files <- files[grepl(".RData", files)]
rdata_files

for (fname in rdata_files) {
 obj_names <- load(fname)
 cat(fname, "\n")
 print(obj_names[grepl("^max", obj_names)])
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM