walkerke / tidycensus

Load US Census boundary and attribute data as 'tidyverse' and 'sf'-ready data frames in R
https://walker-data.com/tidycensus
Other
640 stars 98 forks source link

Error: Internal error: expected a vector #43

Closed pat-s closed 6 years ago

pat-s commented 6 years ago

When using output = wide

df = get_acs(variables = c("B16008_002E", "B19013_001E", "B07401_001E",
                           "B13002_002E", "B24121_255E"), geometry = TRUE,
             geography = "state",
             output = "wide")

Error: Internal error: expected a vector
walkerke commented 6 years ago

I can't reproduce your error - your code works for me. Can you provide the results of your sessionInfo()?

pat-s commented 6 years ago

Oh, interesting! FYI: Error occurs also with the Github version.

 sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Antergos Linux

Matrix products: default
BLAS: /usr/lib/libblas.so.3.8.0
LAPACK: /usr/lib/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2       sf_0.5-5           raster_2.6-7       sp_1.2-5           tidycensus_0.3.1   memuse_4.0-0      
 [7] prompt_1.0.0       mapview_2.2.0      leaflet_1.1.0      forcats_0.2.0      stringr_1.2.0      dplyr_0.7.4       
[13] purrr_0.2.4        readr_1.1.1        tidyr_0.7.2        tibble_1.3.4       ggplot2_2.2.1.9000 tidyverse_1.2.1   
[19] pacman_0.4.6      

loaded via a namespace (and not attached):
 [1] nlme_3.1-131      satellite_1.0.1   devtools_1.13.4   lubridate_1.7.1   webshot_0.4.2     httr_1.3.1       
 [7] rprojroot_1.2     backports_1.1.1   tools_3.4.2       rgdal_1.2-16      R6_2.2.2          rgeos_0.3-26     
[13] DBI_0.7           lazyeval_0.2.1    colorspace_1.3-2  withr_2.1.0       tidyselect_0.2.3  mnormt_1.5-5     
[19] curl_3.0          compiler_3.4.2    cli_1.0.0         rvest_0.3.2       xml2_1.1.9000     scales_0.5.0     
[25] classInt_0.1-24   psych_1.7.8       rappdirs_0.3.1    digest_0.6.12     foreign_0.8-69    rmarkdown_1.8    
[31] R.utils_2.6.0     base64enc_0.1-3   pkgconfig_2.0.1   htmltools_0.3.6   htmlwidgets_0.9   rlang_0.1.4.9000 
[37] readxl_1.0.0      xaringan_0.4.3    rstudioapi_0.7    shiny_1.0.5       bindr_0.1         jsonlite_1.5     
[43] crosstalk_1.0.0   R.oo_1.21.0       magrittr_1.5      Rcpp_0.12.14      munsell_0.4.3     R.methodsS3_1.7.1
[49] stringi_1.1.6     yaml_2.1.14       plyr_1.8.4        grid_3.4.2        maptools_0.9-2    parallel_3.4.2   
[55] crayon_1.3.4      udunits2_0.13     lattice_0.20-35   haven_1.1.0       hms_0.4.0         knitr_1.17       
[61] uuid_0.1-2        gdalUtils_2.0.1.7 reshape2_1.4.2    codetools_0.2-15  clisymbols_1.2.0  stats4_3.4.2     
[67] servr_0.8         glue_1.2.0        evaluate_0.10.1   modelr_0.1.1      png_0.1-7         httpuv_1.3.5     
[73] foreach_1.4.3     cellranger_1.1.0  gtable_0.2.0      assertthat_0.2.0  mime_0.5          xtable_1.8-2     
[79] broom_0.4.3       e1071_1.6-8       class_7.3-14      viridisLite_0.2.0 iterators_1.0.8   tigris_0.5.3     
[85] memoise_1.1.0     units_0.4-6   
mfherman commented 6 years ago

I can't reproduce this specific error either, but I think I've had some issues with certain variables when I include the "E" suffix. Do you get the same error with the following code?

df = get_acs(variables = c("B16008_002", "B19013_001", "B07401_001",
                           "B13002_002", "B24121_255"), geometry = TRUE,
             geography = "state",
             output = "wide")
pat-s commented 6 years ago

@mfherman Yes I do, although the error takes a bit longer to occur.

Here's the traceback, I might dig a bit into it when I have time. Looks like a local problem then..

16: chr(...)
15: lapply(.x, .f, ...)
14: map(chr(...), sym)
13: syms(tbl_if_vars(.tbl, .p, .env, ...))
12: tbl_if_syms(.tbl, .predicate, .env)
11: manip_if(.tbl, .predicate, .funs, enquo(.funs), caller_env(), 
        ...)
10: mutate_if(., grepl("*M$", names(.)), funs(moex))
9: function_list[[k]](value)
8: withVisible(function_list[[k]](value))
7: freduce(value, `_function_list`)
6: `_fseq`(`_lhs`)
5: eval(quote(`_fseq`(`_lhs`)), env, env)
4: eval(quote(`_fseq`(`_lhs`)), env, env)
3: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
2: dat %>% mutate_if(grepl("*M$", names(.)), funs(moex))
1: get_acs(variables = c("B16008_002", "B19013_001", "B07401_001", 
       "B13002_002", "B24121_255"), geometry = TRUE, geography = "state", 
       output = "wide")
pat-s commented 6 years ago

Works on a Debian 9 machine so seems to be a local Arch problem.