这可能看起来像一个简单而基本的问题.我已经研究了r几个月了,似乎我找不到我正在寻找的功能.我甚至不知道如何搜索它....从搜索字符串的想法.
我知道有一个函数来获取变量的定义而不是其内容.我自己解释一下......
> x <- c(4:6,5:9)
> x # This will return the contents of x... 4,5,6,5,6,7,8,9.
> the.function.i.m.looking.for(x) # would return:
> c(4:6,5:9)
Run Code Online (Sandbox Code Playgroud)
有谁记得那个功能?谢谢.
dput是你的意思.从帮助页面:"将R对象的ASCII文本表示写入文件或连接,或使用一个来重新创建对象."
> x <- c(4:6,5:9)
dput(x)
c(4L, 5L, 6L, 5L, 6L, 7L, 8L, 9L)
> x2 <- c(4L, 5L, 6L, 5L, 6L, 7L, 8L, 9L)
> all.equal(x, x2)
[1] TRUE
Run Code Online (Sandbox Code Playgroud)