italocegatta/fipe

Can't run example

msperlin opened this issue · 2 comments

library(fipe)
library(ggplot2)
library(dplyr)

bmw_x6  <- fipe_vehicle(
  model = "x6 ", 
  make = "bmw", 
  year = c(0, 2017:2015),
  date = seq.Date(as.Date("2013-01-01"), as.Date("2017-12-01"), by = "4 months")
)

bmw_x6 

Error in UseMethod("rename_") :
no applicable method for 'rename_' applied to an object of class "list"
In addition: Warning message:
All formats failed to parse. No formats found.

My session info:

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.2

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

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=pt_BR.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=pt_BR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] jsonlite_1.6 dplyr_0.8.3 ggplot2_3.2.1 fipe_0.0.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0 colorspace_1.4-1
[7] R6_2.4.0 rlang_0.4.0 httr_1.4.1 stringr_1.4.0 tools_3.6.1 grid_3.6.1
[13] gtable_0.3.0 withr_2.1.2 lazyeval_0.2.2 assertthat_0.2.1 tibble_2.1.3 crayon_1.3.4
[19] purrr_0.3.2 curl_4.0 glue_1.3.1 stringi_1.4.3 compiler_3.6.1 pillar_1.4.2
[25] scales_1.0.0 lubridate_1.7.4 pkgconfig_2.0.2

I had the same problem, it was the locale.

Using Sys.setlocale(category = "LC_TIME", locale = "pt_BR") before the function solved it for me.

I had the same problem, it was the locale.

Using:

Sys.setlocale("LC_TIME", "Portuguese") # Windows

before the function

this solved it for me.

for more: ?Sys.getlocale()

Examples

Sys.getlocale()
Sys.getlocale("LC_TIME")

Not run:
Sys.setlocale("LC_TIME", "de") # Solaris: details are OS-dependent
Sys.setlocale("LC_TIME", "de_DE.utf8") # Modern Linux etc.
Sys.setlocale("LC_TIME", "de_DE.UTF-8") # ditto
Sys.setlocale("LC_TIME", "de_DE") # OS X, in UTF-8
Sys.setlocale("LC_TIME", "German") # Windows

End(Not run)

Sys.getlocale("LC_PAPER") # may or may not be set

Not run:
Sys.setlocale("LC_COLLATE", "C") # turn off locale-specific sorting,
usually, but not on all platforms