This PR introduces changes to the R project setup process, with minimal changes to the base R environment. The enhancements are triggered when the -l r flag is passed during the project creation.
Changes
Creation of .Rproj file: A .Rproj file is now created as a simple text file with default settings. This file is essential for RStudio to recognize the directory as an non-package R project.
Integration with renv for dependency management: If the -l r flag is passed, the script checks if renv is installed. If not, it installs renv in the base R environment. It then runs renv::init(project = '$path') to create an renv.lock file and an renv folder. These are used to manage the R package dependencies for the project. If no path is specified, renv::init() sets the current directory as the project directory.
Notes
This is a basic setup for an R project. There are other alternatives for more comprehensive project setups, such as using the usethis package. Future enhancements could consider integrating usethis or other project management tools for R.
Testing
Please test this PR by creating a new R project with the -l r flag, as well as -l r -p "PATH/HERE", to verify that the .Rproj file,renv.lockfile, andrenv` folder are created in the desired directory.
Summary
This PR introduces changes to the R project setup process, with minimal changes to the base R environment. The enhancements are triggered when the
-l r
flag is passed during the project creation.Changes
Creation of .Rproj file: A .Rproj file is now created as a simple text file with default settings. This file is essential for RStudio to recognize the directory as an non-package R project.
Integration with
renv
for dependency management: If the-l r
flag is passed, the script checks ifrenv
is installed. If not, it installsrenv
in the base R environment. It then runsrenv::init(project = '$path')
to create anrenv.lock
file and anrenv
folder. These are used to manage the R package dependencies for the project. If no path is specified,renv::init()
sets the current directory as the project directory.Notes
This is a basic setup for an R project. There are other alternatives for more comprehensive project setups, such as using the
usethis
package. Future enhancements could consider integratingusethis
or other project management tools for R.Testing
Please test this PR by creating a new R project with the
-l r
flag, as well as-l r -p "PATH/HERE", to verify that the .Rproj file,
renv.lockfile, and
renv` folder are created in the desired directory.