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
# from dataframes to variable labels? | |
library(tidyverse) | |
library(haven) | |
library(labelled) | |
set.seed(22) | |
new_db <- data_frame(age = floor(rnorm(6,25,10)), | |
sex = gl(2,1,6, labels = c("f","m"))) | |
var.labels <- data_frame(variable = c("age","sex"), | |
label= c("Age in Years","Sex of the participant")) |
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
if(!require("tidyverse")) install.packages("tidyverse") | |
if(!require("haven")) install.packages("haven") | |
if(!require("labelled")) install.packages("labelled") | |
library(tidyverse) | |
library(haven) | |
library(labelled) | |
#crear data frame | |
set.seed(22) |
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 'tidyverse' was built under R version 4.0.4 | |
ggplot(mtcars, aes(disp, hp)) + | |
geom_point() + | |
#fijar el ratio de escala entre los ejes X y Y | |
coord_fixed(ratio = 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 | |
# prueba ------------------------------------------------------------------ | |
#ejemplo del problema y producto esperado | |
x <- c("êãçàúüñ","EÑE","el camión") | |
iconv(x,to = "ASCII//TRANSLIT") | |
#> [1] "eacauun" "ENE" "el camion" | |
# updated ------------------------------------------------------------------ |
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(haven) | |
library(labelled) | |
#crear data frame | |
set.seed(22) | |
dta <- data_frame("edad" = floor(rnorm(6,25,10)), | |
"sexo.per" = gl(2,1,6, labels = c("f","m")), | |
"grado_academico_a_nivel_nacional_" = rep(c("primaria", |
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(haven) | |
library(labelled) | |
#crear data frame | |
set.seed(22) | |
dta <- data_frame("edad" = floor(rnorm(6,25,10)), | |
"peso" = floor(rnorm(6,60,10)), | |
"sexo" = gl(2,1,6, labels = c("f","m")), |
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) | |
library(naniar) | |
# more on naniar: https://cran.r-project.org/web/packages/naniar/vignettes/replace-with-na.html | |
#create foo dataset | |
foo <- tibble(xA=c(1,rep(NA,2),2), | |
xB=c(rep(NA,2),5:4), | |
xC=2:5) %>% | |
mutate_all(.funs = as.double) |
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) | |
library(compareGroups) | |
library(skimr) | |
library(rlang) | |
library(labelled) | |
#importa y limpiar | |
sb <- Seatbelts %>% | |
as_tibble() %>% |
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) | |
library(haven) | |
library(labelled) | |
# crear data frame ------------------------------ | |
set.seed(22) | |
dt_nolab <- tibble(age = floor(rnorm(6,25,10)), |
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 | |
# references: | |
# - https://cran.r-project.org/web/packages/janitor/vignettes/janitor.html#tabyl---a-better-version-of-table | |
#import packages | |
library(dplyr) | |
library(janitor) | |
#explore dataset | |
#storms %>% as_tibble() |
OlderNewer