简体   繁体   English

如何从向量中的名称调用环境对象

[英]How to call environment objects from names in vectors

There are the names of the objects (data_frames) in the specified environment.有指定环境中的对象名称(data_frames)。

ls()
[1] "a"         "b"

I have assigned the names of the objects to a vector, eg n_obj <- c('a', 'b')我已将对象的名称分配给向量,例如n_obj <- c('a', 'b')

How to call my objects using the vector of the names n_obj ?如何使用名称n_obj的向量调用我的对象? n_obj[1] return logical a string 'a', but I need to run 'a' as my saved dataframe 'a' in the environment. n_obj[1]返回逻辑字符串 'a',但我需要在环境中运行 'a' 作为我保存的 dataframe 'a'。

I'd use the get function我会使用 get function

get(n_obj[1])

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

相关问题 如何将多个向量调用到 r 环境中以在另一个 function 中使用它们 - How to call several vectors into the r environment to use them in another function 如何从我的 R 环境中删除所有对象,但名称不同的两个对象除外 - How to delete all objects from my R environment except two that have different names 如何使用值中的名称列表从全局环境调用数据框 - How to call data frames from Global environment using list of names in values 如何根据由公式生成的名称创建向量列表 - how to create a list of vectors from names generated by a formula 如何用向量名称作为级别的多个向量创建数据框? - How to create a dataframe from multiple vectors with vector names as levels? 如何区分包命名空间环境与其他环境对象 - How to distinguish package namespace environment from other environment objects 如何将来自不同向量的多个分布函数调用到 R 中的 function - How to call multiple distribution functions from different vectors into a function in R 清理环境中(数据框的)对象的名称 - Cleaning names (of data frame) objects in the environment 从矢量组合中创建变量名称的矢量 - make a vector of variable names from combinations of vectors 从名称向量创建向量并指定长度 - create vectors from vector of names and assign length
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM