Updating embedded data, for example sysdata.rda

前端 未结 2 1936
长发绾君心
长发绾君心 2021-02-04 13:05

My latest submission to CRAN got bounced back because I have assignments to the global environment which is now frowned upon.

I have an embedded data set (sysdata.rda) t

2条回答
  •  抹茶落季
    2021-02-04 14:02

    Why not have an foo.R file in /data which loads the data and updates it when the user calls data(foo)? This is one of the allowed options for /data, but note the following from Writing R Extensions

    Note that R code should be “self-sufficient” and not make use of extra functionality provided by the package, so that the data file can also be used without having to load the package.

    If you can live with that restriction then data(foo) could load the data, update it, and ensure that it is in a specific named object, which you then refer to in your functions.

提交回复
热议问题