HI,
I am trying to import multiple .dta files and create a dataframe from all imported dta files . I try using the following code but it didn't work. It works for csv files, but I don't have stata to save the plus 100 files I am trying to import and get into a dataframe.
head(vnm)
#> # A tibble: 6 x 352
#> idstd id preference rotation a0 a1 a1a a2 a3a a3a2 a3b
#> <chr> <chr> <chr> <lgl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 598835 7 28 NA 1 99 7 3 3 7 2
#> 2 598836 14 10 NA 1 99 7 3 3 7 2
#> 3 598837 17 35 NA 1 99 7 3 2 7 2
#> 4 598838 45 40 NA 1 99 7 3 3 7 2
#> 5 598839 48 6 NA 1 99 7 3 3 7 2
#> 6 598840 50 24 NA 1 99 7 3 3 7 2
#> # ... with 341 more variables: a3c <chr>, a3 <chr>, a4a <chr>, a4b <chr>,
library(tidyverse)
tbl1 <-
list.files(pattern = "*.dta") %>%
map_df(~read_dta(.))
Error: Can't convert from `$a1` <labelled<double>> to `$a1` <labelled<double>> due to loss of precision.
* Locations: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ...
Values are labelled in `$a1` but not in `$a1`.