qsbase/qs

Unexpected behavior when loading .qs file

Closed this issue · 2 comments

Hi,

given the following minimal example:

tmp01 <- data.frame(
  x1 = rnorm(1000)
  , x2 = rnorm(1000)
)

qs::qsave(tmp01, file = "tmp01.qs")

If I use qs::qload(file = "tmp01.qs") for re-loading the data, I get each column, x1 and x2, as a single object. If I use tmp02 <- qs::qload(file = "tmp01.qs"), I additionally get an environment tmp02. I never saw that before.

If I use qs::qsavem(tmp01, file = "tmp01.qs") instead, qs::qload(file = "tmp01.qs") re-loads the data frame tmp01 as expected.

What is going on here?

Hmm ... perhaps I mixed up qload and qread. Sorry for that. But what is the difference?

Hi, yes qload and qread are different. The base R comparables are load and readRDS.

qload will take a list in a file and put it into the global environment. qread will return an object in a file e.g. tmp02 <- qread("tmp01.qs")