R:使用对象的名称打印对象内部的内容 [英] R: Using object's name to print what is inside the object

查看:37
本文介绍了R:使用对象的名称打印对象内部的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是关于对象类型操作的基本问题.

My question is a basic one concerning object type manipulation.

hello = 3
name = 'hello'

我正在寻找一个函数,它允许我仅使用对象名称来查找值 3.

I'm looking for a function that allows me to find the value 3 by using only the object name.

类似于:

print.the.thing.called(name)
[1] 3

非常感谢!

推荐答案

使用 get 通过名称获取对象:

Use get to get an object by its name :

R> x <- 2
R> get("x")
[1] 2   

这篇关于R:使用对象的名称打印对象内部的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆