Closed jeff1evesque closed 6 years ago
The motivation to implement a package design, was because our R scripts was not able to source
the corresponding scripts, since the current working directory (i.e. C:\Users\jeff1evesque\web-projects\ist-687\R\
) is different from where the current script is working:
> getwd()
[1] "C:/Users/jeff1evesque/Documents"
Also, though it was possible to define an absolute path, for the current working directory. But, this would have been a bit strange, if the codebase was cloned from another system (say osx, or linux), which would mean a relative path of the form c:\
would not make sense. Instead, we needed to restructure the current scripts into the package file structure, which should allow us to load the package via library()
.
Specifically, we decided to refactor our current scripts to the following package structure:
├─ utility/
├─── DESCRIPTION
├─── NAMESPACE
├─── R/
├───── dataframe.R
├───── download.R
├───── package.R
Note: a simple example of an R package can verify the above structure suggestion.
The following source was used a guideline, when creating the corresponding package:
We need to refactor our current
utility
scripts, as a local R package.Note: more information can be further reviewed regarding the decision to create localized R packages.