This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fuente: https://github.com/tidyverse/readxl/issues/486#issuecomment-398224438 | |
``` r | |
library(tidyverse) | |
library(readxl) | |
file_path <- "https://github.com/brianwdavis/public/raw/master/example.xlsx" | |
download.file(file_path, "example.xlsx", mode = "wb") | |
#> | |
read_excel_multiline <- function(filename, row_collapse = 1, ...) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
# 1 el problema! ------------------------------------------------------------ | |
``` | |
la base de datos inicial tiene las columnas de | |
anho y semana | |
sin embargo, para realizar un análisis de regresion | |
en el tiempo, las variables del tiempo tienen que | |
ir del 1 al infinito | |
es decir, no podemos hacer una regresion con |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://community.rstudio.com/t/why-does-scale-x-date-create-labels-for-the-padded-area-too/3031 | |
# https://gist.github.com/avallecam/b5b9738c4eede2f1008daa514aeab2ae | |
``` r | |
# 1 instalar paquetes ------------------------------------------------------- | |
if(!require("tidyverse")) install.packages("tidyverse") | |
if(!require("lubridate")) install.packages("lubridate") | |
if(!require("outbreaks")) install.packages("outbreaks") | |
if(!require("aweek")) install.packages("aweek") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adaptacion de: https://www.r-graph-gallery.com/line-chart-dual-Y-axis-ggplot2.html | |
# uso de solucion: https://stackoverflow.com/a/27495865/6702544 | |
``` r | |
# Libraries | |
library(tidyverse) | |
#> Warning: package 'tidyverse' was built under R version 4.0.4 | |
#> Warning: package 'tibble' was built under R version 4.0.5 | |
#> Warning: package 'dplyr' was built under R version 4.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fuente: https://www.repidemicsconsortium.org/epitrix/\#anonymising-data | |
# en bases con 3000 observaciones puede demorar ~95 segundos | |
``` r | |
if(!require("tidyverse")) install.packages("tidyverse") | |
if(!require("charlatan")) install.packages("charlatan") | |
if(!require("epitrix")) install.packages("epitrix") | |
library(tidyverse) | |
library(charlatan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
# instalar paquetes | |
if(!require("tidyverse")) install.packages("tidyverse") | |
if(!require("palmerpenguins")) install.packages("palmerpenguins") | |
# llamar paquete | |
library(tidyverse) | |
# importar y limpiar datos | |
pinguinos <- palmerpenguins::penguins %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
library(tidyverse) | |
tibble(variable="nombre (apellido compuesto)") %>% | |
#' expresiones regulares | |
#' caso 1: | |
#' nombre (apellido) | |
#' .+ .+ | |
#' (.+) (.+) | |
#' \\1 \\2 | |
#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
# reprex from: https://github.com/avallecam/epichannel | |
library(tidyverse) | |
#> Warning: package 'tidyverse' was built under R version 4.0.4 | |
# disease dataset | |
denv <- | |
readr::read_csv("https://dengueforecasting.noaa.gov/Training/Iquitos_Training_Data.csv") %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
# packages ---------------------------------------------------------------- | |
library(tidyverse) | |
library(srvyr) | |
library(survey) | |
# data -------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
library(tidyverse) | |
#> Warning: package 'ggplot2' was built under R version 3.6.3 | |
#> Warning: package 'dplyr' was built under R version 3.6.3 | |
#> Warning: package 'forcats' was built under R version 3.6.3 | |
library(outbreaks) | |
fluH7N9_china_2013 %>% | |
as_tibble() %>% | |
ggplot(aes(x = date_of_onset)) + | |
geom_bar() + |