R 3.5.0 Error in class(obj) <- "rs.scalar" when loading data frame

rstudio

#1

Hi everyone,

I recently updated my R to 3.5.0, along with all the packages I use. I had several .rda files I was working with in a project that were saved before 3.5.0 that I load into the session. These files are working as intended

But for data.frame/tibble files I've saved since 3.5.0, after using load("<file.rda>") my R Studio throws the error.

  • Error in class(obj) <- "rs.scalar"

After throwing that error, every command returns that error until 3 or 4 commands have been issued, and then R session crashes.

I've noticed the same behavior doesn't occur with vectors or matrices, so I would guess it's some change in the implementation of how the 'save' function handles data.frames for 3.5.0. I'm not sure how to include a 'reproducible' example of this, but essentially is looks like this

library(tidyverse)
#>library(...)

load("oldfile.rda")

#> Run any code I want

load("newfile.rda")

#>Everything returns ' Error in class(obj) <- "rs.scalar" '

SessionInfo detailed below as well. AVRC packages are packages I wrote and maintain for my work. I've rebuilt them all under 3.5.0, so I don't believe that's part of the issue.

This is my first time asking a question here, so I wasn't sure if this fits better in the R Studio IDE or General section. Please let me know if there's anything I forgot, or something else that could be helpful to find a solution. Thank you

sessionInfo()
Session Info, click to expand

R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] readxl_1.1.0 pander_0.6.1 knitr_1.20 forcats_0.3.0 stringr_1.3.1 dplyr_0.7.4
[7] purrr_0.2.4 readr_1.1.1 tidyr_0.8.0 tibble_1.4.2 ggplot2_2.2.1 tidyverse_1.2.1
[13] AVRCDat_0.1.0 AVRCHelp_0.1.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 cellranger_1.1.0 pillar_1.2.2 compiler_3.5.0 plyr_1.8.4 bindr_0.1.1
[7] tools_3.5.0 digest_0.6.15 lubridate_1.7.4 jsonlite_1.5 nlme_3.1-137 gtable_0.2.0
[13] lattice_0.20-35 pkgconfig_2.0.1 rlang_0.2.0 psych_1.8.4 cli_1.0.0 rstudioapi_0.7
[19] parallel_3.5.0 haven_1.1.1 bindrcpp_0.2.2 xml2_1.2.0 httr_1.3.1 hms_0.4.2
[25] grid_3.5.0 glue_1.2.0 R6_2.2.2 foreign_0.8-70 modelr_0.1.2 reshape2_1.4.3
[31] magrittr_1.5 scales_0.5.0 rvest_0.3.2 assertthat_0.2.0 mnormt_1.5-5 colorspace_1.3-2
[37] labeling_0.3 stringi_1.2.2 lazyeval_0.2.1 munsell_0.4.3 broom_0.4.4 crayon_1.3.4


#2

Some troubleshooting questions, to hopefully help narrow this down further:

  1. Does the same problem occur when you load one of your newly created files in R, outside of RStudio?

  2. Do you see the problem behavior when you run the following code in a completely fresh RStudio session (newly launched, do not restore any previous environment or history)?

    save(mtcars, "test_file.Rda")
    load("test_file.Rda")
    

    If not, figuring out what additional steps you have to take before seeing the problem behavior will help in creating a reproducible example.


#3

Hi, thank you for your response.

I finally had a chance to test this morning.

  1. Regular R worked just fine loading the rda file and executing subsequent code

  2. Even when saving mtcars and loading in a fresh sessions I had the exact same error.

I'm going to try reinstalling R studio since it appears the problem is not within R. Thank you again for your help


#4

Not a solution, but some breadcrumbs:

  • From some searching, I'm pretty sure rs.scalar is a class used by the RStudio internals. It looks like the proximal cause is the .rs.scalar() function, but it's not documented and it's unclear what is calling it. Maybe an employee who works on the IDE here can fill in more of the picture.
  • save does have a version parameter whose default effectively changed from 2 to 3 in R 3.5.0 which may be related. To figure out what it does would require digging into the release notes and/or source, though, and it's not really clear how it's getting picked up by RStudio in such a way as to cause problems.

A quick workaround is to use another file format. For rectangular data, CSVs are portable, though not optimized for lots of use cases. For alternative binary formats, maybe check out feather or fst.

That said, this problem should really get fixed.


#5

Reinstalling RStudio did the trick, though it may have been solved by simply updating as well. Thank you both for your input.


#6

Glad the problem resolved!

I've moved this question to the #rstudio-ide category since it seems most likely at this point that it was somehow an IDE issue (if an obscure one).