Is there a straightforward way to turn the functions of a .RData file into a normal code file (.R)?
是否有一种直接的方法将.RData文件的功能转换为普通代码文件(.R)?
3 个解决方案
#1
16
Check out ?dump
. For example:
退房?转储。例如:
newEnv <- new.env()
load("myFunctions.Rdata", newEnv)
dump(c(lsf.str(newEnv)), file="normalCodeFile.R", envir=newEnv)
You may also be interested in ?prompt
(which creates documentation files for objects) and / or ?package.skeleton
.
您可能还对?prompt(为对象创建文档文件)和/或?package.skeleton感兴趣。
#2
3
This recent blog post addresses a basically the same problem:
这篇最近的博客文章解决了一个基本相同的问题:
http://www.r-statistics.com/2010/09/dumping-functions-from-the-global-environment-into-an-r-script-file/
#3
0
There's another solution from another post using sink
还有另一个使用接收器的帖子的解决方案
sink(file="Function.R")
Function # The object
sink()
#1
16
Check out ?dump
. For example:
退房?转储。例如:
newEnv <- new.env()
load("myFunctions.Rdata", newEnv)
dump(c(lsf.str(newEnv)), file="normalCodeFile.R", envir=newEnv)
You may also be interested in ?prompt
(which creates documentation files for objects) and / or ?package.skeleton
.
您可能还对?prompt(为对象创建文档文件)和/或?package.skeleton感兴趣。
#2
3
This recent blog post addresses a basically the same problem:
这篇最近的博客文章解决了一个基本相同的问题:
http://www.r-statistics.com/2010/09/dumping-functions-from-the-global-environment-into-an-r-script-file/
#3
0
There's another solution from another post using sink
还有另一个使用接收器的帖子的解决方案
sink(file="Function.R")
Function # The object
sink()