Skip to content

Commit

Permalink
eppexist skeleton template
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDeto committed Jul 21, 2021
1 parent 81c992f commit bb1f512
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/eppexist.R
Expand Up @@ -11,7 +11,7 @@
#'
#' @return Return a LIST with:
#' \item{pop_uncover }{DataFrame of the population still out of coverage; with its "x", "y" and "weigth".}
#' \item{pop_assigned }{DataFrame with the population assigned and the corresponding center; with its "x", "y","weigth", "id" of the centerand the "iteration" of assing.}
#' \item{pop_assigned }{DataFrame with the population assigned and the corresponding center; with its "x", "y","weight", "id" of the centerand the "iteration" of assing.}
#' \item{remaining_capacity }{DataFrame of the centers and its unused capacity; with "x" and "y" of the center, the "id", and the unused "capacity".}
#' \item{used_capacity }{List of DataFrames with the centers and the info of population covered in each itaration. Each DataFrames have the name of the iteration, and contains the "id", "x" and "y" of the center; and the remaining "capacity" and "used_cap" after the iteration.}
#' @export
Expand Down
55 changes: 55 additions & 0 deletions inst/rmarkdown/templates/template-eppexist/skeleton/skeleton.Rmd
@@ -0,0 +1,55 @@
---
title: "Template Title"
author: "Your Name"
date: "`r format(Sys.time(), '%d de %B, %Y')`"
output: output_format
bibliography: skeleton.bib
link-citations: yes
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(EPP)
centers <- centers_epp # Inlcude here your centers data
pop <- pop_epp # Inlcude here your population data
var_of_weight <- "ICC" # Name of the variable used as weight.
# Include here others parameters of your case
# n <- 3 # Total number of iterations with the distance "d1".
# m <- 0 # Number of iteration in wich change the distance of radium. If m>n only the first distance is usede.
# d1 <- 1000 # Radius in meters that each center covers in the firsts "n" iterations.
# d2 <- 2000 # Radius in meters that each center covers, the last "m" iterations. Default = d1 * 2
crs <- sp::CRS("+init=epsg:32721") # Coordinate Reference Systems (CRS).
```

## Inputs

This report present the coverage evaluation of `r nrow(centers)` centers, and the coverage of `r nrow(pop)` individuals with a `r mean(pop$weight)` mean of `r var_of_weight`.

## Outputs

```{r}
exist <- eppexist(pop = pop, centers = centers, crs = crs)
```

The population how may be out of coverage are `r nrow(exist$pop_uncover)` with a `r mean(exist$pop_uncover$weight)` mean of `r var_of_weight`.

The population assigned to the corresponding center are `r nrow(exist$pop_assigned)` with a `r mean(exist$pop_assigned$weight)` mean of `r var_of_weight`.

```{r}
ggplot(exist$pop_assigned, aes(x = id, y = weight, color = iteration)) +
geom_point(size=6)
```

From the point of the centers, let's look at the unused capacity after processing, to evaluate which centers need to be analyzed for excess supply of quotas.

```{r}
ggplot(exist$remaining_capacity, aes(x = id, y = capacity)) +
geom_point(size=6)
```

# Bibliography

```{r bib, include=FALSE}
# create a bib file for the R packages used in this document
knitr::write_bib(c('base', 'rmarkdown', 'EPP'), file = 'skeleton.bib')
```
4 changes: 4 additions & 0 deletions inst/rmarkdown/templates/template-eppexist/template.yaml
@@ -0,0 +1,4 @@
name: Template eppexist
description: >
This template may help with the description of the results of the return of eppexist function of EPP library.
create_dir: TRUE
@@ -0,0 +1,59 @@
---
title: "Titulo del reporte"
author: "Tu nombre"
date: "`r format(Sys.time(), '%d de %B, %Y')`"
output: output_format
bibliography: skeleton.bib
link-citations: yes
header-includes:
- \usepackage[utf8]{inputenc}
- \usepackage[spanish]{babel}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(EPP); library(ggplot2)
centers <- centers_epp # Inlcuye aqui tu data.frame con información de los centros de atención.
pop <- pop_epp # Inlcuye aqui tu data.frame con información de la población a cubrir.
var_of_weight <- "ICC" # Nombre de la variable usada como "weight".
# Incluye aquí otros parametros que ajusten a tu caso
# n <- 3 # Numero total de iteraciones con la distancia "d1".
# m <- 0 # Numero total de iteraciones considerando dos distancias de radio de acción de los centros.
# d1 <- 1000 # Radio en metros que cada centro cubre en las primeras "n" iteraciones.
# d2 <- 2000 # Radio en metros que cada centro cubre en las últimas "m" - "n" iteracions.
crs <- sp::CRS("+init=epsg:32721") # Sistema de Coordenadas de Referencia (CRS).
```

## Inputs

Este reporte presenta la evaluación de cobertura de `r nrow(centers)` centros, y la cobertura por proximidad de `r nrow(pop)` individuos que presentan una media de `r var_of_weight` equivalente a `r mean(pop$weight)`.

## Outputs

```{r}
exist <- eppexist(pop = pop, centers = centers, crs = crs)
```

La población que no pudo ser cubierta corresponde a `r nrow(exist$pop_uncover)` casos, con una media de `r var_of_weight` equivalente a `r mean(exist$pop_uncover$weight)`.

Por su parte la población asignada a sus correspondientes centros fue de `r nrow(exist$pop_assigned)` casos, con una media de
`r var_of_weight` equivalente a `r mean(exist$pop_assigned$weight)`.

```{r}
ggplot(exist$pop_assigned, aes(x = id, y = weight, color = iteration)) +
geom_point(size=6)
```

Desde el punto de los centros, veamos la capacidad no utilizada después del procesamiento, para evaluar que centros hay que analizar por exceso de oferta de cupos.

```{r}
ggplot(exist$remaining_capacity, aes(x = id, y = capacity)) +
geom_point(size=6)
```

# Bibliography

```{r bib, include=FALSE}
# crea un archivo bib con todos los paquetes usados en este documento
knitr::write_bib(c('base', 'rmarkdown', 'EPP'), file = 'skeleton.bib')
```
4 changes: 4 additions & 0 deletions inst/rmarkdown/templates/template-eppexist_es/template.yaml
@@ -0,0 +1,4 @@
name: Template eppexist_es
description: >
Este template ayuda con la descripción de los resultados que se obtienen con la función eppexist del paquete EPP en español.
create_dir: TRUE

0 comments on commit bb1f512

Please sign in to comment.