You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
library(haven)
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 3.4.2#> ── Attaching packages ────────────────────────────────── tidyverse 1.2.1 ──#> ✔ ggplot2 2.2.1 ✔ purrr 0.2.4#> ✔ tibble 1.3.4 ✔ dplyr 0.7.4#> ✔ tidyr 0.7.2 ✔ stringr 1.2.0#> ✔ readr 1.1.1 ✔ forcats 0.2.0#> Warning: package 'tidyr' was built under R version 3.4.2#> Warning: package 'purrr' was built under R version 3.4.2#> Warning: package 'dplyr' was built under R version 3.4.2#> ── Conflicts ───────────────────────────────────── tidyverse_conflicts() ──#> ✖ dplyr::filter() masks stats::filter()#> ✖ dplyr::lag() masks stats::lag()stata_dt<- read_dta("http://www.stata-press.com/data/r13/manuf.dta") %>% select(temperature,
chemical)
map_chr(stata_dt, typeof)
#> temperature chemical #> "double" "double"
map_lgl(stata_dt, is.labelled)
#> temperature chemical #> TRUE TRUE
write_dta(stata_dt, tempfile(fileext=".dta"))
#> Error: Stata only supports labelled integers.#> Problems: `temperature`, `chemical`
I'm not sure why write_dta is not allowed to save labelled doubles, although up to the previous version it was doing it just fine (at least in my work I've been saving labelled doubles, which were integers but read as doubles by read_dta). I understand that having labelled integers doesn't make sense but most of time labelled doubles are just integers that were read that way. @kuriwaki suggests that write_dta is allowed to save labelled doubles as long as they don't contain decimal points. See #326.
The text was updated successfully, but these errors were encountered:
hadley
added
feature
a feature request or enhancement
bug
an unexpected problem or unintended behavior
and removed
feature
a feature request or enhancement
labels
Feb 15, 2018
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
lockbot
locked and limited conversation to collaborators
Aug 14, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm not sure why
write_dta
is not allowed to save labelled doubles, although up to the previous version it was doing it just fine (at least in my work I've been saving labelled doubles, which were integers but read as doubles byread_dta
). I understand that having labelled integers doesn't make sense but most of time labelled doubles are just integers that were read that way. @kuriwaki suggests thatwrite_dta
is allowed to save labelled doubles as long as they don't contain decimal points. See #326.The text was updated successfully, but these errors were encountered: