Alex
Alex

Reputation: 2780

Load my own R package

I made an R package for personal use, but the way I load it is by individual files. Such as:

source("../compr/R/compr.R")
source("../compr/R/error_df.R")
source("../compr/R/rmse.R")

I would like to load the entire package, which is called compr, as I would other libraries.

Upvotes: 1

Views: 58

Answers (1)

LyzandeR
LyzandeR

Reputation: 37879

If you are using RStudio, I would suggest creating a project and setting it to your compr directory. After that you will be able to use devtools::load_all() to load your package directly.

If you don't want to do this, or you don't use RStudio devtools::load_all('path/to/compr') will also work.

P.S. compr directory needs to be the root of the package i.e. the place where your DESCRIPTION file is.

Upvotes: 1

Related Questions