From ac7c0b65a639375010be2fbfd1878212493756d9 Mon Sep 17 00:00:00 2001 From: Johan Rosa Date: Mon, 26 Dec 2022 11:50:46 -0400 Subject: [PATCH 1/4] Adding README with general information --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..54ef7c5 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ + +# Packages bcdata + + +[![R-CMD-check](https://github.com/Johan-rosa/bcdata/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Johan-rosa/bcdata/actions/workflows/R-CMD-check.yaml) + + +The goal of bcdata is to download and import + +## Installation + +You can install the development version of bcdata from [GitHub](https://github.com/) with: + +``` r +# install.packages("devtools") +devtools::install_github("Johan-rosa/bcdata") +``` + +## Example + +This is a basic example which shows you how to solve a common problem: + +``` r +library(bcdata) +## basic example code +get_ipc_data("grupos") +``` + From 2bac545b81c282be5a80d7821ef9b662d8442d7c Mon Sep 17 00:00:00 2001 From: Johan Rosa Date: Mon, 26 Dec 2022 11:51:31 -0400 Subject: [PATCH 2/4] Update package documentation --- DESCRIPTION | 2 +- NAMESPACE | 3 ++- R/pib_sectores.R | 3 +-- man/get_ipc_data.Rd | 3 ++- man/get_pib_sectores.Rd | 7 +++++++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2f8caf8..00b0c71 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ License: What license is it under? Encoding: UTF-8 LazyData: true URL: http:johan-rosa.com -RoxygenNote: 7.1.0 +RoxygenNote: 7.2.3 Imports: dplyr, tidyr, diff --git a/NAMESPACE b/NAMESPACE index d75f824..6ae9268 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1 +1,2 @@ -exportPattern("^[[:alpha:]]+") +# Generated by roxygen2: do not edit by hand + diff --git a/R/pib_sectores.R b/R/pib_sectores.R index 0251805..a1c9526 100644 --- a/R/pib_sectores.R +++ b/R/pib_sectores.R @@ -16,10 +16,9 @@ #' #' @return Un tibble con la serie del PIB desagregada por sectores de origen. #' -#' @example +#' @examples #' # PIB nominal por sectores de origen, serie trimestral desde 1991, base 2007 #' get_pib_sectores(modalidad = "nominal", acumulado = FALSE, homogenea_91 = TRUE) -#' #' # PIB real por sectores de origen, serie trimestral desde 1991, base 2007 #' get_pib_sectores(modalidad = "nominal", acumulado = FALSE, homogenea_91 = TRUE) #' diff --git a/man/get_ipc_data.Rd b/man/get_ipc_data.Rd index 47d2816..e0f3d35 100644 --- a/man/get_ipc_data.Rd +++ b/man/get_ipc_data.Rd @@ -8,7 +8,8 @@ get_ipc_data(desagregacion = "general") } \arguments{ \item{desagregacion}{string indicando la desagregacion deseada. opciones: -"general", "grupos", "regiones", "subyacente", "tnt" (transable y no transable)} +"general", "grupos", "regiones", "subyacente", "tnt" (transable y no transable), +"articulos"} } \value{ Un tibble con las series del ipc con la desagregacion deseada diff --git a/man/get_pib_sectores.Rd b/man/get_pib_sectores.Rd index bb2fd22..6fb0f66 100644 --- a/man/get_pib_sectores.Rd +++ b/man/get_pib_sectores.Rd @@ -25,3 +25,10 @@ Descarga las series del PIB por sectores de origen, con diferentes alternativas segĂșn las metodolog\\u00edas y opciones de presentaci\\u00f3n de resultados. } +\examples{ +# PIB nominal por sectores de origen, serie trimestral desde 1991, base 2007 +get_pib_sectores(modalidad = "nominal", acumulado = FALSE, homogenea_91 = TRUE) +# PIB real por sectores de origen, serie trimestral desde 1991, base 2007 +get_pib_sectores(modalidad = "nominal", acumulado = FALSE, homogenea_91 = TRUE) + +} From cbbdf2a7a58ae0983b218f5c6243499f6c312564 Mon Sep 17 00:00:00 2001 From: Johan Rosa Date: Mon, 26 Dec 2022 11:52:02 -0400 Subject: [PATCH 3/4] Init github actions checks --- .Rbuildignore | 1 + .github/.gitignore | 1 + .github/workflows/R-CMD-check.yaml | 49 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.Rbuildignore b/.Rbuildignore index 7af2c1d..116ca4d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^bcdata\.Rcheck$ ^bcdata.*\.tar\.gz$ ^bcdata.*\.tgz$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..a3ac618 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true From fe45aff8d65a3ad5dbfe378a27219e8f02f13c29 Mon Sep 17 00:00:00 2001 From: Johan Rosa Date: Mon, 26 Dec 2022 16:54:22 -0400 Subject: [PATCH 4/4] fix file names to have portable names --- R/{funciones utilitarias.R => funciones_utilitarias.R} | 0 R/ipc.R | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) rename R/{funciones utilitarias.R => funciones_utilitarias.R} (100%) diff --git a/R/funciones utilitarias.R b/R/funciones_utilitarias.R similarity index 100% rename from R/funciones utilitarias.R rename to R/funciones_utilitarias.R diff --git a/R/ipc.R b/R/ipc.R index df49a45..240ff01 100644 --- a/R/ipc.R +++ b/R/ipc.R @@ -14,7 +14,10 @@ #' get_ipc_data(desagregacion = "regiones") # Funcion para descargar data del IPC -get_ipc_data <- function(desagregacion = "general"){ +get_ipc_data <- function( + desagregacion = c("general", "grupos", "regiones", "subyacente", "tnt") + ) { + desagregacion <- match.arg(desagregacion) # Asignando el pipe para usarlo sin cargar dplyr `%>%` <- magrittr::`%>%`