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
calculate_dv <- function(rut) { | |
rut_str <- as.character(rut) | |
if (!(nchar(rut_str) %in% c(7, 8))) { | |
stop("The RUT must have 7 or 8 digits.") | |
} | |
rut_str <- substr(rut_str, nchar(rut_str) - 7, nchar(rut_str)) | |
rut_rev <- as.numeric(strsplit(rut_str, NULL)[[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
# Instalamos y cargamos la librería epitools | |
install.packages("epitools") | |
library(epitools) | |
# Casos y controles expuestos | |
exposed <- c(20, 80) | |
unexposed <- c(30, 70) | |
# Creamos una tabla de contingencia | |
tab <- matrix(c(exposed, unexposed), ncol = 2, byrow = TRUE) |
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
## Chinese Zodiac | |
# More info https://www.travelchinaguide.com/intro/astrology/60year-cycle.htm | |
def chinese_zodiac(year:int): | |
elements = ("madera", "fuego", "tierra", "metal", "agua") | |
animals = ("rata", "buey", "tigre", "conejo", "dragón", "serpiente", "caballo", "oveja", "mono", "gallo", "perro", "cerdo") | |
if year < 604: | |
print("El ciclo sexagenario chino comenzó en el año 604. Debes introducir un año adecuado.") |
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
## Chinese Zodiac | |
# More info https://www.travelchinaguide.com/intro/astrology/60year-cycle.htm | |
chinese_zodiac <- function(year) { | |
elements <- list("madera", "fuego", "tierra", "metal", "agua") | |
animals <- list("rata", "buey", "tigre", "conejo", "dragón", "serpiente", "caballo", "oveja", "mono", "gallo", "perro", "cerdo") | |
if (year < 604) { |
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
library(dplyr) | |
vec1 <- 1:7 | |
vec2 <- 1:5 | |
cbind(vec1, vec2) | |
# vec1 vec2 | |
# [1,] 1 1 | |
# [2,] 2 2 | |
# [3,] 3 3 |
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
library(rvest) | |
library(tidyverse) | |
library(lubridate) | |
url <- "https://www.empleospublicos.cl/pub/convocatorias/convocatorias.aspx" | |
web <- read_html(url) | |
job <- web |> | |
html_nodes("#bx_titulos") |> |
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
library(readxl) | |
library(writexl) | |
library(tidyverse) | |
indicators <- read_excel("Talleres/data/Popular_Indicators.xlsx", sheet = "Data") | |
str(indicators) | |
colnames(indicators) | |
unique(indicators$`serie Name`) | |
tail(indicators) |
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
library(tidyverse) | |
ges <- ges_df %>% | |
mutate(problema_de_salud = str_remove(problema_de_salud, pattern = "(\\s?[.]?\\s?[{]\\w+\\s\\w+.\\s?\\d+.?\\d+.)")) |
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
#install.packages("diffr") | |
library(diffr) | |
diffr("example_script1.R", "example_script_2.R") |
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
library(rvest) | |
library(tidyverse) | |
# Get catalogue | |
list_products <- data.frame() | |
for (page_result in seq(from = 1, to = 3, by = 1)) { | |
url <- paste0("https://www.pcfactory.cl/notebooks?categoria=735&papa=636&pagina=", page_result) |