qsbase / qs

Quick serialization of R objects
405 stars 19 forks source link

`qsavem` gives unexpected error when passing a name to its `file` argument in a function #46

Closed psychelzh closed 3 years ago

psychelzh commented 4 years ago

The following script gives an unexpected error. But the name result_file actually has a value.

library(qs)
#> qs v0.23.4.
test <- function() {
  result_file <- "test.qs"
  test1 <- rnorm(100)
  test2 <- rnorm(100)
  qsavem(test1, test2, file = result_file)
}
test()
#> Error in c_qsave(x, file, preset, algorithm, compress_level, shuffle_control, : object 'result_file' not found

Created on 2020-11-29 by the reprex package (v0.3.0)

traversc commented 4 years ago

Thanks for the report. @bryce-chamberlain can you have a look? Maybe checking out what base::save does differently?

traversc commented 3 years ago

Should be fixed now if you want to give it a shot.

devtools::install_github("traversc/qs")
brycechamberlain-ow commented 3 years ago

@traversc thanks for taking care of this one! December has been a very busy month for me.

traversc commented 3 years ago

@bryce-chamberlain No worries! Have a look when you have a chance and see if it's okay.

brycechamberlain-ow commented 3 years ago

@traversc looks good to me. I checked it and it works as expected. @psychelzh can you confirm this is fixed so we can close the issue? thanks!

psychelzh commented 3 years ago

@bryce-chamberlain Thanks! Confirmed here. Hope to be released soon.

traversc commented 3 years ago

On CRAN now.