Creating a Package in R with RStudio

I created a bunch of files:

  • init.r
  • auth.r
  • class.r
  • modules /status.r
  • modules /mgmt.r
  • modules /core.r
  • modules /mcf.r

The source of the init.r file is

# initiation of package # include libraries library(RCurl); library(rjson); # include files source('auth.r'); source('class.r'); # extend class source('modules/status.r'); source('modules/mgmt.r'); source('modules/core.r'); source('modules/mcf.r'); 

How do I create a package from this? The init.r file must first be initiated.

+4
source share
3 answers

Start with the steps described in this video:

Create an R Package in Less Than 2 Minutes with RStudio

Then read more about the RStudio development service , as well as the Hadley Wickam Fundamentals package .

+10
source

See Writing R Extensions for the package creation process. You can use package.skeleton to get started.

But essentially

  • get rid of your init.r file,
  • put all your other .R files in the R directory
  • write Depends: RCurl, rjson in your DESCRIPTION file.
+6
source

1. Create the prerequisites: To create R packages using RStudio, you must have the following prerequisites: P, RStudio, Rtools, Basic MikTex, roxygen2 and devtools.

2. Create an RPackage project in RStudio and add all your R files (init.r, auth.r, class.r, modules / status.r, modules / mgmt.r, modules / core.r, modules / mcf.r) in the R folder of the project.

3. Add documentation by editing the package description file. Create a project, and now your package is ready to use.

to create a simple package will take no more than 15 minutes. If you want to explain step by step how to create a simple package, visit this blog. https://veeramaninatarajanmca.wordpress.com/2017/02/10/how-to-create-a-simple-package-in-r-using-rstudio/

0
source

Source: https://habr.com/ru/post/1446252/


All Articles