KentonWhite / ProjectTemplate

A template utility for R projects that provides a skeletal project.
http://projecttemplate.net
GNU General Public License v3.0
623 stars 159 forks source link

Fixes rstudio project file creation #263

Closed rsangole closed 6 years ago

rsangole commented 6 years ago

Types of change

Pull request checklist


Proposed changes

Hugovdberg commented 6 years ago

You could perhaps, instead of writing a file from a function, create a new file in inst/defaults/ and call file.copy(system.file([...])). Perhaps call it inst/defaults/rstudio/rstudio.rproj, and copy it using

file.copy(system.file(file.path('defaults', 'rstudio', 'rstudio.rproj')), 
          file.path(project.dir, paste0(project.name, '.rproj'))

The system.file function prepends the path to the inst directory of a given package. This allows you to retrieve a file from the installation directory. The file.copy function can rename the file in one go to the project name.

rsangole commented 6 years ago

@Hugovdberg lovely. That's the sort of path I wanted to adopt initially but wasn't sure if we have a 'space' where we're OK saving files like these.

Will send another commit later today.

KentonWhite commented 6 years ago

@rsangole did I miss the new commit? is this ready to be reviewed and merged?

KentonWhite commented 6 years ago

Temporarily closing — seems to be stale.

@rsangole if this is ready to commit please reopen the PR.