successfuly load package `mlbench` but fail toload dataset `LetterRecognition`

I am learning the functions from package rsample with this tutorial on Github.

But when I data(LetterRecognition) but fail it.

library(mlbench)
data(LetterRecognition)
## Error in py_resolve_dots(list(...)) : 
##   object 'LetterRecognition' not found

Created on 2018-11-05 by the reprex package (v0.2.1)

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                                              
#>  version  R version 3.4.4 (2018-03-15)                       
#>  system   x86_64, mingw32                                    
#>  ui       RTerm                                              
#>  language (EN)                                               
#>  collate  Chinese (Simplified)_People's Republic of China.936
#>  tz       Asia/Taipei                                        
#>  date     2018-11-05
#> Packages -----------------------------------------------------------------
#>  package   * version date       source        
#>  backports   1.1.2   2017-12-13 CRAN (R 3.4.3)
#>  base      * 3.4.4   2018-03-15 local         
#>  compiler    3.4.4   2018-03-15 local         
#>  datasets  * 3.4.4   2018-03-15 local         
#>  devtools    1.13.5  2018-02-18 CRAN (R 3.4.3)
#>  digest      0.6.18  2018-10-10 CRAN (R 3.4.4)
#>  evaluate    0.10.1  2017-06-24 CRAN (R 3.4.3)
#>  graphics  * 3.4.4   2018-03-15 local         
#>  grDevices * 3.4.4   2018-03-15 local         
#>  htmltools   0.3.6   2017-04-28 CRAN (R 3.4.3)
#>  knitr       1.20    2018-02-20 CRAN (R 3.4.3)
#>  magrittr    1.5     2014-11-22 CRAN (R 3.4.3)
#>  memoise     1.1.0   2017-04-21 CRAN (R 3.4.4)
#>  methods   * 3.4.4   2018-03-15 local         
#>  mlbench   * 2.1-1   2012-07-10 CRAN (R 3.4.4)
#>  Rcpp        0.12.18 2018-07-23 CRAN (R 3.4.4)
#>  rmarkdown   1.10    2018-06-11 CRAN (R 3.4.4)
#>  rprojroot   1.3-2   2018-01-03 CRAN (R 3.4.3)
#>  stats     * 3.4.4   2018-03-15 local         
#>  stringi     1.1.7   2018-03-12 CRAN (R 3.4.4)
#>  stringr     1.3.1   2018-05-10 CRAN (R 3.4.4)
#>  tools       3.4.4   2018-03-15 local         
#>  utils     * 3.4.4   2018-03-15 local         
#>  withr       2.1.2   2018-03-15 CRAN (R 3.4.4)
#>  yaml        2.2.0   2018-07-25 CRAN (R 3.4.4)

Strange! That’s not the right warning message for when utils::data() can’t find a data set. The message should say:

data(DoesNotExist)
#> Warning message:
#> In data(DoesNotExist) : data set 'DoesNotExist' not found

Have you got anything in your .RProfile or otherwise loaded into your session that might be masking utils::data()? Did you try running the code you posted in a fresh R session?

What’s even odder to me is that the function py_resolve_dots() mentioned in the error you saw exists as an unexported function in reticulate, which according to your session info you don’t even seem to have installed. So I’m not sure what’s going on there :thinking:.
.

1 Like

@jcblum

I find it works when I use stats::data.

library(mlbench)
utils::data(LetterRecognition)

Created on 2018-11-05 by the reprex package (v0.2.1)

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                                              
#>  version  R version 3.4.4 (2018-03-15)                       
#>  system   x86_64, mingw32                                    
#>  ui       RTerm                                              
#>  language (EN)                                               
#>  collate  Chinese (Simplified)_People's Republic of China.936
#>  tz       Asia/Taipei                                        
#>  date     2018-11-05
#> Packages -----------------------------------------------------------------
#>  package   * version date       source        
#>  backports   1.1.2   2017-12-13 CRAN (R 3.4.3)
#>  base      * 3.4.4   2018-03-15 local         
#>  compiler    3.4.4   2018-03-15 local         
#>  datasets  * 3.4.4   2018-03-15 local         
#>  devtools    1.13.5  2018-02-18 CRAN (R 3.4.3)
#>  digest      0.6.18  2018-10-10 CRAN (R 3.4.4)
#>  evaluate    0.10.1  2017-06-24 CRAN (R 3.4.3)
#>  graphics  * 3.4.4   2018-03-15 local         
#>  grDevices * 3.4.4   2018-03-15 local         
#>  htmltools   0.3.6   2017-04-28 CRAN (R 3.4.3)
#>  knitr       1.20    2018-02-20 CRAN (R 3.4.3)
#>  magrittr    1.5     2014-11-22 CRAN (R 3.4.3)
#>  memoise     1.1.0   2017-04-21 CRAN (R 3.4.4)
#>  methods   * 3.4.4   2018-03-15 local         
#>  mlbench   * 2.1-1   2012-07-10 CRAN (R 3.4.4)
#>  Rcpp        0.12.18 2018-07-23 CRAN (R 3.4.4)
#>  rmarkdown   1.10    2018-06-11 CRAN (R 3.4.4)
#>  rprojroot   1.3-2   2018-01-03 CRAN (R 3.4.3)
#>  stats     * 3.4.4   2018-03-15 local         
#>  stringi     1.1.7   2018-03-12 CRAN (R 3.4.4)
#>  stringr     1.3.1   2018-05-10 CRAN (R 3.4.4)
#>  tools       3.4.4   2018-03-15 local         
#>  utils     * 3.4.4   2018-03-15 local         
#>  withr       2.1.2   2018-03-15 CRAN (R 3.4.4)
#>  yaml        2.2.0   2018-07-25 CRAN (R 3.4.4)

I think you meant utils::data :grin:

Anyway, that also suggests that you’ve got something masking data(). If you started a clean session and only loaded the mlbench package, then that should not be the case — mlbench doesn’t have a data() function.

So I’d take a look at your various startup files to see where this might be coming from. It’s not a good idea to have packages (or data frames, via attach()) that you aren’t aware of loading automatically into a clean session (it’s debatable whether it’s ever a good idea at all, but if you’re going to do it you need to be constantly aware of the implications).

1 Like

Hi @jcblum I quickly go through this gitbook.

I have three .Rprofile files on my computer but all are empty.
So I think I don't have some automatic-running code when I start a session.

Hmm, do you have stuff in your environment persisting across session restarts? In RStudio, in order to get a clean session when you choose “Restart R Session”, you have to have both of the following options set to No (not just Ask!):

  • Restore .RData into workspace at startup
  • Save workspace to .RData on exit