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
# setup ------------------------------------------------------------------- | |
library(tidyverse) | |
data <- read_csv("https://raw.githubusercontent.com/MattLunkes/GoT_Affiliations/master/got_char.csv") | |
data | |
data_long <- data %>% | |
janitor::clean_names() %>% | |
rename(end_of_s0 = starting_affiliation) %>% |
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) | |
library(rvest) | |
get_uf <- function(y) { | |
# y <- 2016 | |
message(y) | |
seleccionador <- ifelse(y <= 2012, first, last) |
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
.First <- function(){ | |
.libPaths("~/R/win-library/") | |
} |
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
# x <- "https://raw.githubusercontent.com/melvidoni/r4ds/traduccion_melina/factors.Rmd" | |
# x <- "https://raw.githubusercontent.com/melvidoni/r4ds/traduccion_melina/datetimes.Rmd" | |
chequear_traduccion <- function(x = "https://raw.githubusercontent.com/melvidoni/r4ds/traduccion_melina/factors.Rmd") { | |
library(tidyverse) | |
library(hunspell) | |
library(tidytext) | |
data <- obtener_data(x) |
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
# packages ---------------------------------------------------------------- | |
rm(list = ls()) | |
library(tidyverse) | |
theme_set(theme_minimal()) | |
# data -------------------------------------------------------------------- | |
n <- 500 | |
df <- data_frame( | |
x1 = rnorm(n) + 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
rm(list = ls()) | |
library(tidyverse) | |
library(viridis) | |
theme_set(theme_minimal()) | |
n <- 1000 | |
s <- seq(1, n) | |
x <- sqrt(s) + rnorm(n) + log(s) * rnorm(n) |
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
rm(list = ls()) | |
library(partykit) | |
library(tidyverse) | |
iris2 <- iris %>% | |
tbl_df() %>% | |
mutate(Species = as.character(Species), | |
Species = ifelse(Species == "setosa", "versicolor", Species), | |
Species = as.factor(Species)) |
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
Arbol de decisión: | |
Algoritmo que divide recursivamente grupo de observaciones según valores | |
de variables de acuerdo a una variable de interés y una medida de separación. | |
El objetivo de usar el árbol de decisión es obtener grupos de observaciones | |
en donde cada segmento tenga distribuciones disimiles de la variable de interés | |
Random Forest: | |
Es una colección de árboles de decisión tales que cada árbol es construido |
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
x <- system("ipconfig", intern=TRUE) | |
x[grep("IPv4", x)] | |
z <- x[grep("IPv4", x)] | |
ip <- gsub(".*? ([[:digit:]])", "\\1", z) | |
runApp(host = ip) |
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
# run via | |
# source("https://gist.githubusercontent.com/jbkunst/981a6416025d3d7d80303bc20e5269fa/raw/install.packages.R") | |
install.packages(c( | |
# tidyverse | |
"tidyverse", "broom", | |
# io | |
"RODBC", "odbc", "readxl", "writexl", "dbplyr", | |
# development | |
"devtools", "testthat", "roxygen2", "assertthat", |