diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..2eb964e --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,3 @@ +^LICENSE\.md$ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..03c2bc3 --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,19 @@ +Package: workflow.scenario.preparation +Title: Run the Scenario Preparation Workflow +Version: 0.0.0.9000 +Authors@R: + person(c(person(given = "Jackson", + family = "Hoffart", + role = c("aut", "cre", "ctr"), + email = "jackson.hoffart@gmail.com", + comment = c(ORCID = "0000-0002-8600-5042")), + person(given = "RMI", + role = c("cph", "fnd"), + email = "PACTA4investors@rmi.org")) +Description: A workflow to prepare climate change scenarios for the PACTA tool. +License: MIT + file LICENSE +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 +Imports: + dplyr diff --git a/Dockerfile b/Dockerfile index e4d7ade..9d59e13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,20 +2,22 @@ FROM --platform=linux/amd64 rocker/tidyverse # install system dependencies for R packages RUN apt-get update \ - && apt-get install -y git \ && rm -rf /var/lib/apt/lists/* -RUN Rscript -e 'install.packages(c("pak", "renv"))' +# copy in DESCRIPTION from this repo +COPY DESCRIPTION /DESCRIPTION + +# install pak, find dependencies from DESCRIPTION, and install them +RUN Rscript -e "\ + install.packages('pak'); \ + deps <- pak::local_deps(root = '.'); \ + pkg_deps <- deps[!deps[['direct']], 'ref']; \ + print(pkg_deps); \ + pak::pak(pkg_deps); \ + " COPY . /workflow.scenario.preparation WORKDIR /workflow.scenario.preparation -RUN Rscript -e '\ - readRenviron(".env"); \ - non_cran_pkg_deps <- c("RMI-PACTA/pacta.scenario.data.preparation"); \ - cran_pkg_deps <- setdiff(renv::dependencies()$Package, basename(non_cran_pkg_deps)); \ - pak::pkg_install(pkg = c(non_cran_pkg_deps, cran_pkg_deps)); \ - ' - CMD Rscript run_pacta_scenario_preparation.R diff --git a/LICENSE b/LICENSE index b12f8fc..7ec6c95 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2023 RMI-PACTA - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +YEAR: 2024 +COPYRIGHT HOLDER: RMI diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..c3f0481 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2024 RMI + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/run_pacta_scenario_preparation.R b/run_pacta_scenario_preparation.R index ab352f3..be244d2 100644 --- a/run_pacta_scenario_preparation.R +++ b/run_pacta_scenario_preparation.R @@ -1,4 +1,4 @@ -library(tidyverse) +library(dplyr) mtcars %>% distinct(cyl, mpg) diff --git a/workflow.scenario.preparation.Rproj b/workflow.scenario.preparation.Rproj index 4f10a56..f6cd4b6 100644 --- a/workflow.scenario.preparation.Rproj +++ b/workflow.scenario.preparation.Rproj @@ -14,3 +14,7 @@ LaTeX: XeLaTeX AutoAppendNewline: Yes StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source