Saving R objects (code) in .R files (R genetic programming)

前端 未结 4 1842
囚心锁ツ
囚心锁ツ 2021-01-21 17:02

I\'m using R for genetic programming with the RGP package. The environment creates functions that solve problems. I want to save these functions in their own .R source files. I

4条回答
  •  孤街浪徒
    2021-01-21 17:29

    You can pass save the names of objects to be saved via the list argument

    save(list="bf_str", file="MyBestFunction.R")
    

    Alternatively, you could use dput

    dput(bf_str, file='MyFun.R')
    

    and dget to retrieve

    bf_str <- dget("MyFun.R")
    

提交回复
热议问题