Reputation: 1110
I've created a bunch of files:
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 go about creating a package out of this? The init.r file obviously needs to be initiated first.
Upvotes: 5
Views: 4588
Reputation: 352
1. Build the prerequisites: To build R Packages using RStudio, you should have the following prerequisites like R, RStudio, Rtools, Basic MikTex, roxygen2 and devtools packages.
2. Create the 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) under the R folder of the project.
3. Add the documentation by editing the package description file. Build the project and now your package is ready to use.
it won't take more than 15 minutes to build a simple package. If you wish to have step by step explanation to create a simple package, please visit this blog. https://veeramaninatarajanmca.wordpress.com/2017/02/10/how-to-create-a-simple-package-in-r-using-rstudio/
Upvotes: 0
Reputation: 1426
Start with following the steps in this video:
Build an R Package in under 2 minutes with RStudio
Then read more about RStudio's Package Development feature, and also Hadley Wickam's Package basics.
Upvotes: 10
Reputation: 17642
See Writing R Extensions
for the process of making a package. You might want to use package.skeleton
to get started.
But essentially,
init.r
file, .R
files in the R
directoryDepends: RCurl, rjson
in your DESCRIPTION file. Upvotes: 6