Skip to content

Instantly share code, notes, and snippets.

@briatte
Created February 25, 2020 13:41
Show Gist options
  • Save briatte/a3078e30518fd9179e7dedf8649716cc to your computer and use it in GitHub Desktop.
Save briatte/a3078e30518fd9179e7dedf8649716cc to your computer and use it in GitHub Desktop.
# package dependency
library(haven)
path_in = "new_EB with more var_2004-2016.dta"
out_tsv = "new_EB.tsv"
out_sav = "new_EB.sav"
# name repair shows the issue with _merge
x = haven::read_dta(p, .name_repair = "universal")
names(x)[ names(x) == "._merge" ] = "MERGEVAR"
haven::write_tsv(x, out_tsv) # TSV
haven::write_sav(x, out_sav) # SAV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment