rv init
rv init
will initialize a new or existing project by:
- Setting up the project infrastructure, including the project library and activation scripts.
- Create configuration file which is populated with the R version and repositories
rv init [project_directory] [OPTIONS]
Arguments
Section titled “Arguments”-
project_directory
optional - Creates anrv
project at the directory specifiedDefault: current directory (
./
)
Options
Section titled “Options”-
--r-version
- The R version is set to be the version found on the path by default. Use this flag to set a custom version. -
--no-repositories
- The repositories are set to what is found in the current R session, inoption("repos")
, by default. This flag leaves the repositories field in the config file blank. -
--add
- The dependency field is blank by default. This flag can be used to add dependencies you know will be needed to the project immediately. It does not sync these dependencies likerv add
. -
--no_r_environment
- By default,rv
creates an R environment.rv
to enablerv
to be called in R code (see rvr for more info). This flag will disable this R environment. -
--force
- By default, if anrproject.toml
exists within a directory already,rv
will not overwrite the file. The flag will force the creation of a new config file.
Example
Section titled “Example”Follow the tabs below to see the changes:
rv init my_rv_project --r-version 4.5 --add tidyverse
Directorymy_rv_project
Directoryrv/
Directorylibrary/
- …
Directoryscripts/
- activate.R set the library and repositories within R
- rvr.R set up
.rv
. See rvr for more info
- .gitignore ignores the library
- .Rprofile
- rproject.toml
[project]name = "my_rv_project"r_version = "4.5"
# any CRAN-type repository, order matters. Additional ability to force source package installation# Example: {alias = "CRAN", url = "https://cran.r-project.org", force_source = true}repositories = [ {alias = "CRAN", url = "https://cran.rstudio.com" }]
# package to install and any specifications. Any descriptive dependency can have the `install_suggestions` specification# Examples: # "dplyr", # {name = "dplyr", repository = "CRAN", force_source = true}, # {name = "dplyr", git = "https://github.com/tidyverse/dplyr.git", tag = "v1.1.4"}, # {name = "dplyr", path = "/path/to/local/dplyr"},dependencies = [ "tidyverse",]