开发者

Turning RData file into script files

开发者 https://www.devze.com 2023-01-18 12:55 出处:网络
Is there a straightforward way to turn th开发者_高级运维e functions of a .RData file into a normal code file (.R)?Check out ?dump.For example:

Is there a straightforward way to turn th开发者_高级运维e functions of a .RData file into a normal code file (.R)?


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.


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/


There's another solution from another post using sink

sink(file="Function.R")
Function # The object
sink()
0

精彩评论

暂无评论...
验证码 换一张
取 消