Created
December 12, 2018 03:17
-
-
Save avallecam/d204f18bc5c415a96e168274b169532f to your computer and use it in GitHub Desktop.
De R a STATA: errores por caracteres en nombres de columna
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", | |
"secundaria"), | |
each=3)) | |
#regla | |
!grepl("^[A-Za-z_]{1}[A-Za-z0-9_]{0,31}$", names(dta)) | |
#fuente: | |
#https://github.com/tidyverse/haven/blob/master/R/haven.R | |
#con error | |
dta %>% write_dta("data/test.dta") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment