Skip to content

Commit

Permalink
Merge branch 'master' into T61
Browse files Browse the repository at this point in the history
  • Loading branch information
andreavargasmon authored Feb 22, 2021
2 parents 55347ab + 80eeb13 commit 6be92de
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 69 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^Meta$
^img$
^\.github$
37 changes: 37 additions & 0 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.

name: R

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: macOS-latest
strategy:
matrix:
r-version: [3.5, 3.6]

steps:
- uses: actions/checkout@v2
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@ffe45a39586f073cc2e9af79c4ba563b657dc6e3
with:
r-version: ${{ matrix.r-version }}
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
shell: Rscript {0}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ inst/doc
.Rproj.user

*.DS_Store
doc
Meta
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Depends:
R (>= 4.0.0)
VignetteBuilder: knitr
Imports:
gradethis,
learnr,
rsconnect,
ggplot2,
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Generated by roxygen2: do not edit by hand

import(learnr)
import(dplyr)
8 changes: 0 additions & 8 deletions R/ixpantia-introR-package.R

This file was deleted.

102 changes: 95 additions & 7 deletions R/lista_tutoriales.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,98 @@
#' Listar los tutoriales disponibles en el paquete
#' @import dplyr
NULL

#' @title Practicar con tutorial
#'
#' @description Despliega el tutorial elegido por su nombre en un navegador web
#'
#' @details La función necesita que en el computador docker esté instalado y que
#' se hayan agregado las lineas siguientes en la terminal:
#'
#' @param nombre_tutorial Es el nombre de uno de los tutoriales dentro del
#' paquete ixpantia.introR
#'
#' @examples
#'\dontrun{
#' practicar("pizarra_coercion")
#'}
practicar <- function(nombre_tutorial) {
tutoriales <- available_tutorials("ixpantia.introR") %>%
as_tibble()

nombres <- tutoriales %>%
select(name) %>%
pull()

if (!nombre_tutorial %in% nombres) {
nombres <- tutoriales %>%
select(name) %>%
pull()
print("Nombre no válido. Elegir alguno de los siguientes:")
nombres
}

learnr::run_tutorial(nombre_tutorial, package = "ixpantia.introR")
}

#' @title Listar tutoriales
#'
#' @description Genera una lista con los tutoriales disponibles en el paquete.
#'
#' @details La función permitar dar una lista de los tutoriales disponibles en
#' el paquete por su tipo, ya sea tarea o pizarra.
#'
#' @import learnr
#' @return lista Lista de tutoriales
lista_tutoriales <- function() {
#' @param tipo Es el tipo del tutorial que queremos listar. Puede ser `tarea` o
#' `pizarra`
#'
#' @examples
#'\dontrun{
#' listar_tutoriales(tipo = "pizarra")
#'}
listar_tutoriales <- function(tipo) {

if (is.null(tipo)) {
"Por favor indique el tipo del tutorial"
}

if (tipo == "tarea") {
tutoriales <- learnr::available_tutorials("ixpantia.introR") %>%
tibble::as_tibble() %>%
dplyr::filter(startsWith(name, "tarea"))
} else if (tipo == "pizarra") {
tutoriales <- learnr::available_tutorials("ixpantia.introR") %>%
tibble::as_tibble() %>%
dplyr::filter(startsWith(name, "pizarra"))
}
return(tutoriales)
}

#' @title Instalar dependendencias
#'
#' @description Muestra las dependencias del paquete ixpantia.introR que son
#' necesarias para poder practicar con los tutoriales interactivos
#'
#' @details El paquete ixpantia.introR toma en cuenta una cantidad de paquetes
#' que son necesarios para practicar con los tutoriales interactivos. Sino
#' tenemos estos paquetes instalados en nuestro computador, no podremos hacer
#' uso de los tutoriales. Si en algún caso no sabemos cuál paquete nos falta,
#' esta función nos dará la lista de dependencias.
#'
#' @param tipo Es el tipo del tutorial que queremos listar. Puede ser `tarea` o
#' `pizarra`
#'
#' @examples
#'\dontrun{
#' listar_tutoriales(tipo = "pizarra")
#'}
revisar_dependencias <- function(instalar = FALSE) {

tutoriales <- learnr::available_tutorials(package = "ixpantia.introR")
lista <- tutoriales$tutorials
return(lista)
if (instalar == TRUE) {
# Si defino paquetes fuera no realiza la instalacion y busca el objeto
install.packages(tutorial_package_dependencies(package = "ixpantia.introR"))
} else {
return(tutorial_package_dependencies(package = "ixpantia.introR"))
}
}



38 changes: 0 additions & 38 deletions man/ixpantia.introR-package.Rd

This file was deleted.

14 changes: 0 additions & 14 deletions man/lista_tutoriales.Rd

This file was deleted.

24 changes: 24 additions & 0 deletions man/listar_tutoriales.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/practicar.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions man/revisar_dependencias.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6be92de

Please sign in to comment.