Giter Club home page Giter Club logo

qs's Introduction

Using qs

R-CMD-check CRAN-Status-Badge CRAN-Downloads-Badge CRAN-Downloads-Total-Badge

Quick serialization of R objects

qs provides an interface for quickly saving and reading objects to and from disk. The goal of this package is to provide a lightning-fast and complete replacement for the saveRDS and readRDS functions in R.

Inspired by the fst package, qs uses a similar block-compression design using either the lz4 or zstd compression libraries. It differs in that it applies a more general approach for attributes and object references.

saveRDS and readRDS are the standard for serialization of R data, but these functions are not optimized for speed. On the other hand, fst is extremely fast, but only works on data.frame’s and certain column types.

qs is both extremely fast and general: it can serialize any R object like saveRDS and is just as fast and sometimes faster than fst.

Usage

library(qs)
df1 <- data.frame(x = rnorm(5e6), y = sample(5e6), z=sample(letters, 5e6, replace = T))
qsave(df1, "myfile.qs")
df2 <- qread("myfile.qs")

Installation

# CRAN version
install.packages("qs")

# CRAN version compile from source (recommended)
remotes::install_cran("qs", type = "source", configure.args = "--with-simd=AVX2")

Features

The table below compares the features of different serialization approaches in R.

qs fst saveRDS
Not Slow
Numeric Vectors
Integer Vectors
Logical Vectors
Character Vectors
Character Encoding (vector-wide only)
Complex Vectors
Data.Frames
On disk row access
Random column access
Attributes Some
Lists / Nested Lists
Multi-threaded

qs also includes a number of advanced features:

  • For character vectors, qs also has the option of using the new ALTREP system (R version 3.5+) to quickly read in string data.
  • For numerical data (numeric, integer, logical and complex vectors) qs implements byte shuffling filters (adopted from the Blosc meta-compression library). These filters utilize extended CPU instruction sets (either SSE2 or AVX2).
  • qs also efficiently serializes S4 objects, environments, and other complex objects.

These features have the possibility of additionally increasing performance by orders of magnitude, for certain types of data. See sections below for more details.

Summary Benchmarks

The following benchmarks were performed comparing qs, fst and saveRDS/readRDS in base R for serializing and de-serializing a medium sized data.frame with 5 million rows (approximately 115 Mb in memory):

data.frame(a = rnorm(5e6), 
           b = rpois(5e6, 100),
           c = sample(starnames$IAU, 5e6, T),
           d = sample(state.name, 5e6, T),
           stringsAsFactors = F)

qs is highly parameterized and can be tuned by the user to extract as much speed and compression as possible, if desired. For simplicity, qs comes with 4 presets, which trades speed and compression ratio: “fast”, “balanced”, “high” and “archive”.

The plots below summarize the performance of saveRDS, qs and fst with various parameters:

Serializing

De-serializing

(Benchmarks are based on qs ver. 0.21.2, fst ver. 0.9.0 and R 3.6.1.)

Benchmarking write and read speed is a bit tricky and depends highly on a number of factors, such as operating system, the hardware being run on, the distribution of the data, or even the state of the R instance. Reading data is also further subjected to various hardware and software memory caches.

Generally speaking, qs and fst are considerably faster than saveRDS regardless of using single threaded or multi-threaded compression. qs also manages to achieve superior compression ratio through various optimizations (e.g. see “Byte Shuffle” section below).

ALTREP character vectors

The ALTREP system (new as of R 3.5.0) allows package developers to represent R objects using their own custom memory layout. This allows a potentially large speedup in processing certain types of data.

In qs, ALTREP character vectors are implemented via the stringfish package and can be used by setting use_alt_rep=TRUE in the qread function. The benchmark below shows the time it takes to qread several million random strings (nchar = 80) with and without ALTREP.

The large speedup demonstrates why one would want to consider the system, but there are caveats. Downstream processing functions must be ALTREP-aware. See the stringfish package for more details.

Byte shuffle

Byte shuffling (adopted from the Blosc meta-compression library) is a way of re-organizing data to be more amenable to compression. An integer contains four bytes and the limits of an integer in R are +/- 2^31-1. However, most real data doesn’t use anywhere near the range of possible integer values. For example, if the data were representing percentages, 0% to 100%, the first three bytes would be unused and zero.

Byte shuffling rearranges the data such that all of the first bytes are blocked together, all of the second bytes are blocked together, and so on. This procedure often makes it very easy for compression algorithms to find repeated patterns and can often improve compression ratio by orders of magnitude. In the example below, shuffle compression achieves a compression ratio of over 1:1000. See ?qsave for more details.

# With byte shuffling
x <- 1:1e8
qsave(x, "mydat.qs", preset = "custom", shuffle_control = 15, algorithm = "zstd")
cat( "Compression Ratio: ", as.numeric(object.size(x)) / file.info("mydat.qs")$size, "\n" )
# Compression Ratio:  1389.164

# Without byte shuffling
x <- 1:1e8
qsave(x, "mydat.qs", preset = "custom", shuffle_control = 0, algorithm = "zstd")
cat( "Compression Ratio: ", as.numeric(object.size(x)) / file.info("mydat.qs")$size, "\n" )
# Compression Ratio:  1.479294 

Serializing to memory

You can use qs to directly serialize objects to memory.

Example:

library(qs)
x <- qserialize(c(1, 2, 3))
qdeserialize(x)
[1] 1 2 3

Serializing objects to ASCII

The qs package includes two sets of utility functions for converting binary data to ASCII:

  • base85_encode and base85_decode
  • base91_encode and base91_decode

These functions are similar to base64 encoding functions found in various packages, but offer greater efficiency.

Example:

enc <- base91_encode(qserialize(datasets::mtcars, preset = "custom", compress_level = 22))
dec <- qdeserialize(base91_decode(enc))

(Note: base91 strings contain double quote characters (") and need to be single quoted if stored as a string.)

See the help files for additional details and history behind these algorithms.

Using qs within Rcpp

qs functions can be called directly within C++ code via Rcpp.

Example C++ script:

// [[Rcpp::depends(qs)]]
#include <Rcpp.h>
#include <qs.h>
using namespace Rcpp;

// [[Rcpp::export]]
void test() {
  qs::qsave(IntegerVector::create(1,2,3), "/tmp/myfile.qs", "high", "zstd", 1, 15, true, 1);
}

R side:

library(qs)
library(Rcpp)
sourceCpp("test.cpp")
# save file using Rcpp interface
test()
# read in file created through Rcpp interface
qread("/tmp/myfile.qs")
[1] 1 2 3

The C++ functions do not have default parameters; all parameters must be specified.

Future developments

  • Additional compression algorithms
  • Improved ALTREP serialization
  • Re-write of multithreading code
  • Mac M1 optimizations (NEON) and checking

Future versions will be backwards compatible with the current version.

qs's People

Contributors

brycechamberlain-ow avatar renkun-ken avatar romainfrancois avatar salim-b avatar shrektan avatar traversc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qs's Issues

Allow `file` being an url or connection?

I have a somewhat special use case where I need to download R objects from GitHub.

Currently the workflow is readRDS(url("some_github_url")) which is working because readRDS allows a connection for it's file argument. I realized that qs::qread() could speed this up heavily as reading some example files from disk is more than 4 times faster.

However, I wasn't able to do this without downloading the file to a temp directory like in the below function

load_qs <- function(url) {
  tmp <- tempfile(fileext = "qs")
  download.file(url, tmp, quiet = TRUE)
  qs::qread(tmp)
}

I am pretty sure this isn't the most efficient solution and would like to ask for ideas or even the implementation analogue to readRDS?
(I don't know if this is an awful idea so please let me know!)

nanotime are not loaded back correctly in qs

Hello there seem to be a bug when saving nanotimes in data.tables
I am using qs_0.13.1

R> qs::qsave(data.table(x=nanotime(100)), "/tmp/test.qs")
R> qs::qread("/tmp/test.qs")
                               x
1: 1677-09-21T00:11:28.145224192
Warning message:
In `*.integer64`(secs, as.integer64(1e+09)) :
  NAs produced by integer64 overflow

If that helps the same thing works using fst

qs saves include extra items in environments

This problem is described for rds's here (since fixed in base R) and occurs when saving via qs:

https://stat.ethz.ch/pipermail/r-devel/2016-July/072924.html

In short, qs seems to serialize all objects in an enclosing environment when writing items that include environments such as lm or ggplot.

save_size_qs <- function (object) {
  tf <- tempfile(fileext = ".qs")
  on.exit(unlink(tf))
  qs::qsave(object, file = tf)
  file.size(tf)
}

save_size_rds <- function (object) {
  tf <- tempfile(fileext = ".rds")
  on.exit(unlink(tf))
  saveRDS(object, file = tf)
  file.size(tf)
}

normal_lm <- function(){
  junk <- 1:1e+08
  lm(Sepal.Length ~ Sepal.Width, data = iris)
}

normal_ggplot <- function(){
  junk <- 1:1e+08
  ggplot2::ggplot()
}

clean_lm <- function () {
  junk <- 1:1e+08
  # Run the lm in its own environment
  env <- new.env(parent = globalenv())
  env$subset <- subset
  with(env, lm(Sepal.Length ~ Sepal.Width, data = iris))
}

# The qs save size includes the junk but the rds does not
save_size_qs(normal_lm())
#> [1] 848396
save_size_rds(normal_lm())
#> [1] 4178
save_size_qs(normal_ggplot())
#> [1] 857446
save_size_rds(normal_ggplot())
#> [1] 12894

# Both exclude the junk when separating the lm into its own environment
save_size_qs(clean_lm())
#> [1] 6154
save_size_rds(clean_lm())
#> [1] 4273

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

install.packages() error in RHEL

Tried to upgrade to version 0.19.1, but got the message below.

System info

[leungi@ohylpyt1-d ~]$ uname -a
Linux ohylpyt1-d 3.10.0-514.6.1.el7.x86_64 #1 SMP Sat Dec 10 11:15:38 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
* installing *source* package âqsâ ...
** package âqsâ successfully unpacked and MD5 sums checked
** using staged installation
checking for pkg-config... /bin/pkg-config
zstd dynamic library not detected -- compiling from source
lz4 dynamic library not detected -- compiling from source
-L. -lQSZSTD -lQSLZ4
-IZSTD -IZSTD/common -IZSTD/decompress -IZSTD/compress -ILZ4
LIBZSTD = ZSTD/common/debug.o ZSTD/common/entropy_common.o ZSTD/common/error_private.o ZSTD/common/fse_decompress.o ZSTD/common/pool.o ZSTD/common/threading.o ZSTD/common/xxhash.o ZSTD/common/zstd_common.o ZSTD/compress/fse_compress.o ZSTD/compress/hist.o ZSTD/compress/huf_compress.o ZSTD/compress/zstd_compress.o ZSTD/compress/zstd_double_fast.o ZSTD/compress/zstd_fast.o ZSTD/compress/zstd_lazy.o ZSTD/compress/zstd_ldm.o ZSTD/compress/zstdmt_compress.o ZSTD/compress/zstd_opt.o ZSTD/decompress/huf_decompress.o ZSTD/decompress/zstd_ddict.o ZSTD/decompress/zstd_decompress_block.o ZSTD/decompress/zstd_decompress.o ZSTD/dictBuilder/cover.o ZSTD/dictBuilder/divsufsort.o ZSTD/dictBuilder/fastcover.o ZSTD/dictBuilder/zdict.o LIBLZ4 = LZ4/lz4.o LZ4/lz4hc.o $(SHLIB): libQSZSTD.a libQSLZ4.a libQSZSTD.a: $(LIBZSTD) $(AR) rcs libQSZSTD.a $(LIBZSTD) libQSLZ4.a: $(LIBLZ4) $(AR) rcs libQSLZ4.a $(LIBLZ4) clean: rm -f $(SHLIB) $(OBJECTS) $(LIBZSTD) libQSZSTD.a $(LIBLZ4) libQSLZ4.a
configure: creating ./config.status
config.status: creating src/Makevars
** libs
/usr/local/gcc493/bin/g++49 -std=c++0x -I"/usr/include/R" -DNDEBUG -DRCPP_USE_UNWIND_PROTECT -I. -IZSTD -IZSTD/common -IZSTD/decompress -IZSTD/compress -ILZ4 -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/RApiSerialize/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
In file included from /usr/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:61:0,
                 from /usr/lib64/R/library/Rcpp/include/RcppCommon.h:29,
                 from /usr/lib64/R/library/Rcpp/include/Rcpp.h:27,
                 from ../inst/include/qs_RcppExports.h:7,
                 from ../inst/include/qs.h:7,
                 from RcppExports.cpp:4:
RcppExports.cpp: In function âSEXPREC* _qs_is_big_endian_try()â:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:14:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:14:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qsave_try(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:46:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:46:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qsave_fd_try(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:86:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:86:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qsave_handle_try(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:125:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:125:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qserialize_try(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:164:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:164:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qread_try(SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:202:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:202:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qread_fd_try(SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:238:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:238:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qread_handle_try(SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:273:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:273:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qread_ptr_try(SEXP, SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:308:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:308:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qdeserialize_try(SEXP, SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:344:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:344:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_c_qdump_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:379:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:379:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_randomStrings_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:412:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:412:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_zstd_compress_bound_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:447:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:447:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_lz4_compress_bound_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:480:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:480:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_zstd_compress_raw_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:513:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:513:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_zstd_decompress_raw_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:547:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:547:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_lz4_compress_raw_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:580:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:580:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_lz4_decompress_raw_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:614:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:614:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_blosc_shuffle_raw_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:647:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:647:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_blosc_unshuffle_raw_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:681:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:681:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_xxhash_raw_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:715:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:715:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_convertToAlt_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:748:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:748:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_openFd_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:781:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:781:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_readFdDirect_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:815:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:815:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_closeFd_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:849:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:849:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_openMmap_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:882:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:882:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_closeMmap_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:916:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:916:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_openHandle_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:950:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:950:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_closeHandle_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:984:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:984:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_openWinFileMapping_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:1017:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:1017:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_openWinMapView_try(SEXP, SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:1051:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:1051:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
RcppExports.cpp: In function âSEXPREC* _qs_closeWinMapView_try(SEXP:
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:32:9: warning: unused variable ânprotâ [-Wunused-variable]
     int nprot = 0;                                                                               \
         ^
RcppExports.cpp:1085:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/lib64/R/library/Rcpp/include/Rcpp/macros/macros.h:36:17: warning: unused variable âstop_symâ [-Wunused-variable]
     static SEXP stop_sym = Rf_install("stop");                                                   \
                 ^
RcppExports.cpp:1085:1: note: in expansion of macro âBEGIN_RCPPâ
 BEGIN_RCPP
 ^
/usr/local/gcc493/bin/g++49 -std=c++0x -I"/usr/include/R" -DNDEBUG -DRCPP_USE_UNWIND_PROTECT -I. -IZSTD -IZSTD/common -IZSTD/decompress -IZSTD/compress -ILZ4 -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/RApiSerialize/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c qs_functions.cpp -o qs_functions.o
In file included from qs_functions.cpp:21:0:
qs_common.h: In member function âint fd_wrapper::ferror()â:
qs_common.h:457:40: error: âerrnoâ was not declared in this scope
     return fcntl(fd, F_GETFD) == -1 || errno == EBADF;
                                        ^
qs_common.h:457:49: error: âEBADFâ was not declared in this scope
     return fcntl(fd, F_GETFD) == -1 || errno == EBADF;
                                                 ^
qs_common.h: In function âuint32_t validate_data(const QsMetadata&, stream_reader&, uint32_t, uint32_t, uint64_t, bool:
qs_common.h:1157:34: error: âto_stringâ is not a member of âstdâ
                                  std::to_string(recorded_hash) + "," + std::to_string(computed_hash) + "), data may be corrupted");
                                  ^
qs_common.h:1157:72: error: âto_stringâ is not a member of âstdâ
                                  std::to_string(recorded_hash) + "," + std::to_string(computed_hash) + "), data may be corrupted");
                                                                        ^
qs_common.h: In member function âuint64_t zstd_decompress_env::decompress(void*, size_t, const void*, size_t:
qs_common.h:1528:124: error: âto_stringâ is not a member of âstdâ
     if(return_value > BLOCKSIZE) throw std::runtime_error("Malformed compress block: decompressed size > max blocksize " + std::to_string(return_value));
                                                                                                                            ^
qs_common.h: In member function âuint64_t lz4_decompress_env::decompress(char*, int, const char*, int:
qs_common.h:1545:146: error: âto_stringâ is not a member of âstdâ
     if(static_cast<uint64_t>(return_value) > BLOCKSIZE) throw std::runtime_error("Malformed compress block: decompressed size > max blocksize" + std::to_string(return_value));
                                                                                                                                                  ^
qs_functions.cpp: In function âRcpp::RObject c_qdump(const string&:
qs_functions.cpp:492:32: error: âto_stringâ is not a member of âstdâ
     outvec["readable_bytes"] = std::to_string(readable_bytes);
                                ^
qs_functions.cpp:493:35: error: âto_stringâ is not a member of âstdâ
     outvec["decompressed_size"] = std::to_string(totalsize);
                                   ^
qs_functions.cpp:496:33: error: âto_stringâ is not a member of âstdâ
       outvec["recorded_hash"] = std::to_string(recorded_hash);
                                 ^
qs_functions.cpp:504:33: error: âto_stringâ is not a member of âstdâ
       outvec["computed_hash"] = std::to_string(computed_hash);
                                 ^
qs_functions.cpp:514:32: error: âto_stringâ is not a member of âstdâ
     outvec["readable_bytes"] = std::to_string(readable_bytes);
                                ^
qs_functions.cpp:515:35: error: âto_stringâ is not a member of âstdâ
     outvec["decompressed_size"] = std::to_string(totalsize);
                                   ^
qs_functions.cpp:516:31: error: âto_stringâ is not a member of âstdâ
     outvec["computed_hash"] = std::to_string(computed_hash);
                               ^
qs_functions.cpp:519:33: error: âto_stringâ is not a member of âstdâ
       outvec["recorded_hash"] = std::to_string(recorded_hash);
                                 ^
qs_functions.cpp:558:32: error: âto_stringâ is not a member of âstdâ
     outvec["readable_bytes"] = std::to_string(readable_bytes);
                                ^
qs_functions.cpp:559:34: error: âto_stringâ is not a member of âstdâ
     outvec["number_of_blocks"] = std::to_string(totalsize);
                                  ^
qs_functions.cpp:562:31: error: âto_stringâ is not a member of âstdâ
     outvec["computed_hash"] = std::to_string(xenv.digest());
                               ^
qs_functions.cpp:565:33: error: âto_stringâ is not a member of âstdâ
       outvec["recorded_hash"] = std::to_string(recorded_hash);
                                 ^
qs_functions.cpp: In function âstd::string xxhash_raw(SEXP:
qs_functions.cpp:714:10: error: âto_stringâ is not a member of âstdâ
   return std::to_string(xenv.digest());
          ^
In file included from qs_functions.cpp:21:0:
qs_common.h: In member function âint fd_wrapper::ferror()â:
qs_common.h:459:3: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
qs_functions.cpp: In function âstd::string xxhash_raw(SEXP:
qs_functions.cpp:715:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [qs_functions.o] Error 1
ERROR: compilation failed for package âqsâ
* removing â/usr/lib64/R/library/qsâ
* restoring previous â/usr/lib64/R/library/qsâ

The downloaded source packages are in
        â/tmp/Rtmp2hvomn/downloaded_packagesâ
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("qs") :
  installation of package âqsâ had non-zero exit status

Serialization benchmark

Hi, if I made a speed comparison vs default serialize. I'm not sure where I did wrong, but the speed seems very close. If there any benefit by doing qserialize?

Random generated ~800KB

image

Random generated ~8MB

image

I guess the data is randomly generated and there is no benefit compressing it?

Also, I have several questions

  1. Is there in-memory multi-threaded serialization method that I could try to serialize array-like objects (split data and serialize for each block automatically)
  2. If I want to write Rcpp functions that uses qs package, is there any interface that I can ply with now?

Thanks

error when using data.table setnames(): ALTSTRING classes must provide a Set_elt method

when saving a data.table with qsave, no matter which preset compression, and then using setnames() from data.table, the following error pops out:

Error in setnames(føl1, føl_reg$dan_s, føl_reg$dan) : ALTSTRING classes must provide a Set_elt method
This error doesn't happen if setnames() is used directly on the data.table before it is saved and read with qsave/qread.

however by copying the DT with copy() then the error disappears. The error also disappears when creating a new variable, even by reference like so:
DT[, var := 1L]

but it doesn't disapper just by making another reference to the same object with
DT_copy <- DT
, and it doesn't disappear by using setcolorder() before doing the setnames(). however, setcolorder works, it just doesn't change whatever needs to be changed in order for setnames() to work correctly.

I can't figure out which variables it is that creates this problem, since a simple 1 column data.table with a character vector does not create the error.

the dataset with the error attached, and can also be downloaded here:
https://www.dropbox.com/s/16bhw6eplywcoej/egne_f%C3%B8lelser_datasheet.xlsx?dl=0

egne_følelser_datasheet.xlsx

fatal error: R_ext/Altrep.h: No such file or directory

Hi

I'm very excited about this package, sounds impressive.

Having some issues installing though. I succesfully installed the latest version of both dependencies:

  • Rcpp - 1.0.1
  • RApiSerialise 0.1.0

Then downloaded the latest package source: qs_0.14.1.tar.gz

When I install from package source, I get the following:

> install.packages("C:/Users/Rvermaak/Downloads/qs_0.14.1.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/Users/Rvermaak/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'qs' ...
** package 'qs' successfully unpacked and MD5 sums checked

   **********************************************
   WARNING: this package has a configure script
         It probably needs manual configuration
   **********************************************


** libs
c:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=gnu++11 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I. -IZSTD -IZSTD/common -IZSTD/decompress -IZSTD/compress -ILZ4 -I"C:/Users/Rvermaak/Documents/R/win-library/3.5/Rcpp/include" -I"C:/Users/Rvermaak/Documents/R/win-library/3.5/RApiSerialize/include"   -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=gnu++11 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I. -IZSTD -IZSTD/common -IZSTD/decompress -IZSTD/compress -ILZ4 -I"C:/Users/Rvermaak/Documents/R/win-library/3.5/Rcpp/include" -I"C:/Users/Rvermaak/Documents/R/win-library/3.5/RApiSerialize/include"   -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include"     -O2 -Wall  -mtune=core2 -c qs_functions.cpp -o qs_functions.o
In file included from qs_functions.cpp:21:0:
qs_header.h:59:26: fatal error: R_ext/Altrep.h: No such file or directory
 #include <R_ext/Altrep.h>
                          ^
compilation terminated.
make: *** [C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/etc/x64/Makeconf:215: qs_functions.o] Error 1
ERROR: compilation failed for package 'qs'
* removing 'C:/Users/Rvermaak/Documents/R/win-library/3.5/qs'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘C:/Users/Rvermaak/Downloads/qs_0.14.1.tar.gz’ had non-zero exit status
> 

Any ideas, please?

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

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)

when using a for-loop and creating a variable by reference (data.table), no variable is created

Hi, so, when loading a data.table saved as an qs-file, and using a for-loop with by-reference created variables, the package fails, like so:

dat1 <- data.table(id=c(1,1,1,2,2,2), runif(6,0,5))
dat2 <- data.table(id=c(3,3,3,4,4,4), runif(6,0,5))
qsave(dat1, './dat1.qs', preset='high')
dat1 <- qread('./dat1.qs')
qsave(dat2, './dat2.qs', preset='high')
dat2 <- qread('./dat2.qs')

for (DT in c('dat1', 'dat2')) {
	get(DT)[, newcol := 1]
}

if, however, one does not save it as a qs-object, or, if not doing the variable creation in a loop, but for each indiviual data.table, everything is fine. I tried using the argument use_alt_rep=F as well, but that does not help. if one uses the copy() function just after loading the qs-objects, it also works, but that seems very inefficient on big data.tables.

greetings, Emil

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.04

Matrix products: default
BLAS/LAPACK: /opt/intel/compilers_and_libraries_2019.2.187/linux/mkl/lib/intel64_lin/libmkl_rt.so

locale:
 [1] LC_CTYPE=en_DK.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_DK.UTF-8        LC_COLLATE=en_DK.UTF-8    
 [5] LC_MONETARY=en_DK.UTF-8    LC_MESSAGES=en_DK.UTF-8   
 [7] LC_PAPER=en_DK.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] data.table_1.12.6 qs_0.19.1        

loaded via a namespace (and not attached):
[1] colorspace_1.4-1    bit_1.1-14          compiler_3.6.1     
[4] Rcpp_1.0.2          bit64_0.9-7         RApiSerialize_0.1.0

Show error/warning if qread() fails because file doesn't exist?

Hi

This is a great package, and really speeds up load times for my Shiny apps.

Just a minor issue/suggestion. If a user uses qread() to open a file that doesn't exist (i.e. usually because they've made a typo in the file name, like I did), no warning or error message currently appears. The user can check to see if the variable you are loading to is null but otherwise doesn't know it didn't work.

For example the code below shows no warning.

library(qs)
test <- qread("imaginary_file.q")

It'd be nice if it could show a similar error message to read_csv which gives the error:

library(readr)
test <- read_csv("imaginary_file.csv")
#> Error: 'imaginary_file.csv' does not exist in current working directory ('/tmp/RtmpBMDlXz').

Thanks, and keep up the good work!

unable to write to DBFS?

This is a wonderful package!
qsave() is 24x faster than saveRDS() in my case when saving a large R object (30-60GB).

When I was working on Databricks clusters, I was unable to write .qs file as qsave(df, “/dbfs/myfile.qs“ (no error message). However, I can successfully do saveRDS(df, “/dbfs/myfile.rds”).

I figured out a walkaround is that I can write to the local driver node first qsave(df, “myfile.qs”)and then transfer the .qs to DBFS location. I am pretty sure it is not the most efficient way, did I miss anything here?

Meanwhile I had no problem in reading from DBFS after I transferred the file qread("/dbfs/myfile.qs").

-pthread not found on Mac OS X 11.6 (Big Sur), qs package does not build

I was using another package that uses qs::qread(), and qs::qread() was crashing. To debug the crash, I wanted to rebuild the qs package from source, and add some debugging print statements along the way to try to diagnose the problem.

However, when I cloned the qs repo and rebuilt the package using R CMD INSTALL qs, the package did not build, complaining that the linker could not find -pthread.

I'm running on mac os x 11.6 (Big Sur). Apple made a bunch of changes to low-level system libraries that broke lots of things, and caused lots of problems. Fortunately, I was able to fix the problem by adding two lines to the MakeVars.in file:

# changes necessary to work with Big Sur
PKG_LIBS+= -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/..
PKG_LIBS+= -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

Not sure @traversc if you wanted to address the issue by adjusting MakeVars.in or if you wanted to address the problem a different way.

BTW, once I was able to rebuild qs from source, the other package I was using that called qs::qread() started working properly again - so the bug doesn't appear to be related to qs::qread(), or at least, everything is working as expected in the latest version.

QS cannot compress R6 object efficiently

RiskModel <- R6Class(
classname = "RiskModel",
public = list(
name = NULL,
covMat = NULL, ## N * N
initialize = function(name, covMat = NULL) {
}
),
private = NULL,
active = NULL,
inherit = NULL,
lock_objects = TRUE,
class = TRUE,
portable = TRUE,
lock_class = FALSE,
cloneable = TRUE,
parent_env = parent.frame()
)

if i initialize RiskModel with covMat size:10000*10000, the object serialized by readr::write_rds and qs::qsave will get two files with almost same size. when i serialized covMat directly, the size of two files will be much different!

Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, inspect, : something went wrong (reading string header)

I have a batch of output, each containing 100 rows, with a mix of column data types, including list-columns.

Out of 478 outputs, only 1 had generated the subject error on read.

> data <- qs::qread(my_files[[i]])
Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, inspect,  : 
  something went wrong (reading string header)

Can this be due to corruption on save? I don't see any warning/error message on save, so it may be useful to have qs check file readability (random sampling of rows) on saved object.

Question about the back compatibility policy

I am developing a package called targets, a Make-like pipeline tool for R. Like Make, targets tries to skip targets that are already up to date. Unlike Make, targets uses the hashes of data files to make decisions about which targets to run. Because of its incredible efficiency, qs is now the default data storage format. However, this comes with back compatibility risks, so I would like to touch base about your development plans. Will future versions of qread() be able to read files saved with earlier versions of qs (beginning with 0.23.2)? Will the hash of data serialized with qsave(preset = "high") change over time? The latter case is easier to cope with, especially due to ropensci/targets#142 (comment).

Failing save/read on an S4 class Raster

Enjoying your package. The speeds are great! I have a reprex of a failing save/restore with qs. It requires raster package. Any chance this is fixable?

library(qs)
library(raster)

nx <- ny <- 100
N <- nx * ny
template <- raster(nrows = ny, ncols = nx, xmn = -nx / 2, xmx = nx / 2,
                   ymn = -ny / 2, ymx = ny / 2)

# Make dummy map
DEM <- raster(template)
DEM[] <- runif(N)
# Save and restore it
tf <- tempfile(fileext = ".qs"); 
qsave(DEM, file = tf)
DEM2 <- qread(tf)

all.equal(DEM@legend@names, DEM2@legend@names)
# [1] "Modes: logical, character"               "Lengths: 0, 1"                          
# [3] "target is logical, current is character"

# With RDS -- fine
tf <- tempfile(fileext = ".rds"); 
saveRDS(DEM, file = tf)
DEM3 <- readRDS(tf)

all.equal(DEM@legend@names, DEM3@legend@names)
# [1] TRUE

example(qsame) assumes exists() is vectorized, but it isn't

qs/man/qread.Rd contains several calls to exists() with more than one name given as the 'x' argument:
% grep exists *
qreadm.Rd:exists(c('x1', 'x2')) # returns true
qreadm.Rd:exists(c('x1', 'x2')) # returns true
qsavem.Rd:exists(c('x1', 'x2')) # returns true
qsavem.Rd:exists(c('x1', 'x2')) # returns true

exists(c("x1","x2")) ignores the "x2" and returns the same thing as exists("x1"), without a warning. Those calls should be replaced by
exists('x1') && exists('x2')

Files with ".q" extension causing some issues in RStudio

Hi

I've been using qs successfully over the past month but began noticing some strange and quite major slow downs in RStudio in projects that have files saved with ".q" extensions. This is particularly the case if the .q file is large (i.e. I have a few files that are >300MB).

I logged the issue with RStudio (rstudio/rstudio#4696), and Kevin has explained in his comments why, for historical reasons, files with the ".q" extension are treated similarly to ".s" and ".r" files.

It looks like they'll fix the issue but I'm just wondering whether in your documentation you may want to consider using a different file extension type because the issue impacts all versions of R Studio so may cause some headaches for other package users.

Thanks
Anthony

Segfault reading a list with a data frame with ALTREP

Reproduced with base R:

library(palmerpenguins)
library(qs)
library(tidyverse)
species <- c("Adelie", "Gentoo", "Chinstrap")
data <- lapply(species, function(x) penguins[penguins$species == x, ])
data[[1]] # good
data[[1]][, "bill_length_mm"] # good
file <- tempfile()
qsave(data, file)
without_altrep <- qread(file, use_alt_rep = FALSE)
without_altrep[[1]] # good
without_altrep[[1]][, "bill_length_mm"] # good
with_altrep <- qread(file, use_alt_rep = TRUE)
with_altrep[[1]] # good
with_altrep[[1]][, "bill_length_mm"] # segfault

Session info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] forcats_0.5.0        stringr_1.4.0        dplyr_1.0.2          purrr_0.3.4         
 [5] readr_1.3.1          tidyr_1.1.2          tibble_3.0.3         ggplot2_3.3.2       
 [9] tidyverse_1.3.0      qs_0.23.2            palmerpenguins_0.1.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0     xfun_0.16            haven_2.3.1          colorspace_1.4-1    
 [5] vctrs_0.3.4          generics_0.0.2       htmltools_0.5.0.9000 yaml_2.2.1          
 [9] utf8_1.1.4           blob_1.2.1           rlang_0.4.7          pillar_1.4.6        
[13] withr_2.2.0          glue_1.4.2           DBI_1.1.0            dbplyr_1.4.4        
[17] modelr_0.1.8         readxl_1.3.1         lifecycle_0.2.0.9000 munsell_0.5.0       
[21] gtable_0.3.0         cellranger_1.1.0     rvest_0.3.6          stringfish_0.14.1   
[25] evaluate_0.14        RApiSerialize_0.1.0  knitr_1.29           fansi_0.4.1         
[29] broom_0.7.0          Rcpp_1.0.5           scales_1.1.1         backports_1.1.9     
[33] RcppParallel_5.0.2   jsonlite_1.7.0       fs_1.5.0             hms_0.5.3           
[37] packrat_0.5.0        digest_0.6.25        stringi_1.4.6        grid_4.0.2          
[41] cli_2.0.2            tools_4.0.2          magrittr_1.5         crayon_1.3.4        
[45] pkgconfig_2.0.3      ellipsis_0.3.1       xml2_1.3.2           reprex_0.3.0        
[49] lubridate_1.7.9      assertthat_0.2.1     rmarkdown_2.3        httr_1.4.2          
[53] rstudioapi_0.11      R6_2.4.1             compiler_4.0.2  

Large Data Objects Not Always Saving Correctly

I'm not sure how to provide a MWE, but I can describe the situation. Before I do, I want to tell you how much I love this package. It's extraordinary! As you know, it outperforms everything* in terms of speed while maintaining ancillary attributes.

Here is the issue: I'm working with data frames containing between 3 and 150 million rows and 40 or so variables on Linux. Everything works fine using RDS. Things usually go with when I use the much faster QS format. However, once in a while, out of the blue, I'll save a file and it will be smaller than expected. When I open these smaller than expected files, I get the following error: Error in c_qread(file, use_alt_rep, strict, nthreads) : QS format not detected

Is this user error? If you need any other info to troubleshoot, please let me know.

Data-driven error: something went wrong (reading object header)

We have been happily using the qs library for quite some time now, but for the first time we just hit a bug using qserialize that is very data-driven. Specifically, we get this error for some input foo:

bar <- qs::qdeserialize(qs::qserialize(foo))
Error in c_qdeserialize(x, use_alt_rep, strict) : 
  something went wrong (reading object header)

Unfortunately, we are contractually prohibited from providing the data for foo, or we certainly would. However, we can say that small modifications to the contents of foo cause the error to go away. Is this an issue you are aware of? If so, is there anything we might do to avoid it in the future?

qs version

qs_0.21.2 (upgrading didn't resolve the issue)

R version:

platform       x86_64-redhat-linux-gnu     
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          6.0                         
year           2019                        
month          04                          
day            26                          
svn rev        76424                       
language       R                           
version.string R version 3.6.0 (2019-04-26)
nickname       Planting of a Tree          

Thanks!

Saving big list: Error in c_qsave(x, file, ...): bad binding access

Hi qs team,

I'm looking to save a list of 14 elements and I'm running into this error: "Error in c_qsave(x, file, preset, algorithm, compress_level, shuffle_control, : bad binding access"

The list contains several data.table's, a model object, a list of plots, individual plots, and even null elements at times. When I use save() it save without issue. If I'm using qs::qsave() inappropriately then my apologies ahead of time. Below are my computer specs and some code to recreate the error. Let me know if you need anything else to help troubleshoot.

PS Great package!

I'm working on a windows machine and here is the session info:

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] 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] timeDate_3043.102

loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 compiler_4.0.3 pillar_1.4.6
[4] qs_0.23.5 iterators_1.0.12 tools_4.0.3
[7] catboost_0.24.3 digest_0.6.25 viridisLite_0.3.0
[10] lubridate_1.7.9 jsonlite_1.7.2 lifecycle_0.2.0
[13] tibble_3.0.4 gtable_0.3.0 lattice_0.20-41
[16] pkgconfig_2.0.3 rlang_0.4.7 Matrix_1.2-18
[19] foreach_1.5.0 rstudioapi_0.11 crosstalk_1.1.0.1
[22] yaml_2.2.1 parallel_4.0.3 RemixAutoML_0.3.3
[25] httr_1.4.1 dplyr_1.0.2 generics_0.0.2
[28] arules_1.6-6 vctrs_0.3.2 htmlwidgets_1.5.1
[31] grid_4.0.3 tidyselect_1.1.0 RApiSerialize_0.1.0
[34] glue_1.4.1 data.table_1.13.2 R6_2.4.1
[37] plotly_4.9.2.1 farver_2.0.3 tidyr_1.1.2
[40] ggplot2_3.3.2 purrr_0.3.4 magrittr_1.5
[43] scales_1.1.1 codetools_0.2-16 ellipsis_0.3.1
[46] htmltools_0.5.0 colorspace_1.4-1 labeling_0.3
[49] stringfish_0.14.2 RcppParallel_5.0.2 lazyeval_0.2.2
[52] doParallel_1.0.15 munsell_0.5.0 crayon_1.3.4

Code to recreate the error is below:

# Load data
data <- data <- data.table::fread("https://www.dropbox.com/s/2str3ek4f4cheqi/walmart_train.csv?dl=1")

# Set negative numbers to 0
data <- data[, Weekly_Sales := data.table::fifelse(Weekly_Sales < 0, 0, Weekly_Sales)]

# Remove IsHoliday column
data[, IsHoliday := NULL]

# Change data types
data[, ":=" (Store = as.character(Store), Dept = as.character(Dept))]

# Fill gaps
data <- RemixAutoML::TimeSeriesFill(
  data,
  DateColumnName = "Date",
  GroupVariables = c("Store","Dept"),
  TimeUnit = "weeks",
  FillType = "maxmax",
  MaxMissingPercent = 0.25,
  SimpleImpute = TRUE)

# Shrink data for example
data <- data[Store %in% c(1:3)]

# Shrink data rows
data <- data[Date < "2012-03-09"]

# Build model
TestModel <- RemixAutoML::AutoCatBoostCARMA(

  # data args
  data = data,
  TimeWeights = 0.9999,
  TargetColumnName = "Weekly_Sales",
  DateColumnName = "Date",
  HierarchGroups = NULL,
  GroupVariables = c("Store","Dept"),
  TimeUnit = "weeks",
  TimeGroups = c("weeks","months"),

  # Production args
  TrainOnFull = FALSE,
  SplitRatios = c(1 - 10 / 110, 10 / 110),
  PartitionType = "random",
  FC_Periods = 33,
  TaskType = "GPU",
  NumGPU = 1,
  Timer = TRUE,
  DebugMode = TRUE,

  # Target variable transformations
  TargetTransformation = FALSE,
  Methods = c("YeoJohnson", "BoxCox", "Asinh", "Log", "LogPlus1", "Sqrt", "Asin", "Logit"),
  Difference = FALSE,
  NonNegativePred = TRUE,
  RoundPreds = FALSE,

  # Calendar-related features
  CalendarVariables = c("week","wom","month","quarter"),
  HolidayVariable = c("USPublicHolidays"),
  HolidayLags = c(1,2,3),
  HolidayMovingAverages = c(2,3),

  # Lags, moving averages, and other rolling stats
  Lags = list("weeks" = c(1,2,3,4,5,8,9,12,13,51,52,53), "months" = c(1,2,6,12)),
  MA_Periods = list("weeks" = c(2,3,4,5,8,9,12,13,51,52,53), "months" = c(2,6,12)),
  SD_Periods = NULL,
  Skew_Periods = NULL,
  Kurt_Periods = NULL,
  Quantile_Periods = NULL,
  Quantiles_Selected = NULL,

  # Bonus features
  AnomalyDetection = NULL,
  XREGS = NULL,
  FourierTerms = 0,
  TimeTrendVariable = TRUE,
  ZeroPadSeries = NULL,
  DataTruncate = FALSE,

  # ML grid tuning args
  GridTune = FALSE,
  PassInGrid = NULL,
  ModelCount = 5,
  MaxRunsWithoutNewWinner = 50,
  MaxRunMinutes = 60*60,

  # ML evaluation output
  PDFOutputPath = NULL,
  SaveDataPath = NULL,
  NumOfParDepPlots = 0L,

  # ML loss functions
  EvalMetric = "RMSE",
  EvalMetricValue = 1,
  LossFunction = "RMSE",
  LossFunctionValue = 1,

  # ML tuning args
  NTrees = 50L,
  Depth = 6L,
  L2_Leaf_Reg = NULL,
  LearningRate = NULL,
  Langevin = FALSE,
  DiffusionTemperature = 10000,
  RandomStrength = 1,
  BorderCount = 254,
  RSM = NULL,
  GrowPolicy = "SymmetricTree",
  BootStrapType = "Bayesian",
  ModelSizeReg = 0.5,
  FeatureBorderType = "GreedyLogSum",
  SamplingUnit = "Group",
  SubSample = NULL,
  ScoreFunction = "Cosine",
  MinDataInLeaf = 1)

# Save output (Error on this step)
qs::qsave(TestModel, file = file.path(getwd(), "Insights.Rdata"))

# Comparison (this works)
save(TestModel, file = file.path(getwd(), "Insights.Rdata"))

Wrapper to replace base save and load operations

It'd be awesome if there were qs versions of the save and load operations from base, where you can give a file argument and a bunch of objects (also as args) and it'll save them in a list with qs, and then you can read them into the workspace again with a load function.

Should be relatively easy to do - I might make an attempt.

package qs had non-zero exit status

Hello,
I am trying to install the package "qs" using r/3.6.1 and I keep getting the error "installation of package 'qs' had non-zero exit status'. Prior to that error I see these messages:

/tmp/ccwSjoWV.s: Assembler messages:
/tmp/ccwSjoWV.s:1106: Error: no such instruction: shlx %r13,%rax,%rax' /tmp/ccwSjoWV.s:1147: Error: no such instruction: shlx %rcx,%r13,%rcx'
/tmp/ccwSjoWV.s:1170: Error: no such instruction: shlx %r12,%rcx,%r12' /tmp/ccwSjoWV.s:1185: Error: no such instruction: shlx %rbx,%rcx,%rcx'
/tmp/ccwSjoWV.s:1288: Error: no such instruction: shrx %rdx,%rax,%rdx' /tmp/ccwSjoWV.s:1544: Error: no such instruction: shlx %rsi,%rdx,%rdx'
/tmp/ccwSjoWV.s:1628: Error: no such instruction: shrx %rax,%rdx,%rdx' /tmp/ccwSjoWV.s:1689: Error: no such instruction: shlx %rsi,%rcx,%rdx'
make: *** [ZSTD/compress/huf_compress.o] Error 1
ERROR: compilation failed for package ‘qs’

the package installs correctly on another machine that uses R/4.0. Does this package only work on the updated version of R?

Thank you,
Briana

Memory bloat on .q file load

Hi,

I was promoting your qs package to another user, when he realized that upon loading .q files into R session, the object size may be bloated by 2-3x.

I validated his findings with my own .q files.

The file size shown in RStudio Environment pane may be misleading (reflecting similar size as saved object), but inspecting object size via object.size() and checking memory use via Windows Resource Monitor confirmed this bloating issue.

To do list and help wanted

This issue is intended as a place to keep track of things I want to change or look at in future versions:

To do list:

  • Refactor common functions (e.g. header read/write functions)
  • Better error handling (file read check, compression check, RAII for PROTECT
  • Can we use pipes as another option instead of just files? I.e., like the pipe function in R. Possibly with the boost library
  • Other compression algorithms? In ver 0.16.1, Google's Brotli did not perform better than zstd
  • Evaluate zstd's zstd_compressBlock function (in ver. 1.4.0)
  • Support for R alt-rep aware serialization (Does this need to be R version aware? R 3.5 vs 3.6)
  • Support for fast serialization of S4 objects
  • Benchmarking/parameter optimization
  • Automatic detection of SIMD in configure file
  • Configure file for Windows possible?
  • Evaluate other byte/bit shuffling routines, e.g.:
    -- https://github.com/kiyo-masui/bitshuffle
    -- https://github.com/powturbo/TurboPFor

On the off chance someone is reading this:

If you think this project is interesting and would possibly like to collaborate, please get in touch! I am especially looking for someone with expertise in C++11 concurrency and/or expertise in R alt-rep and R internals.

Questions about the benchmark

Thanks for the package. I have a couple of questions regarding the benchmark in the README:

  1. Where can I find the benchmark script so that I can replicate it on my system?
  2. Which compression algorithm is used in saveRDS()? I assume "bzip2", but this should be documented.
  3. Why are gzip, xz and uncompressed (compress = FALSE) not included in the benchmark?
  4. AFAIK saveRDS() is single threaded for bzip2. How is it possible that it is so much faster with 4 threads?

Note about AGPL-3 license

AGPL-3 is sufficiently unusual that I think it's worth a brief note in the readme. It's likely to make it impossible for people to use inside many companies (for example, both google and facebook forbid the use of AGPL software).

qs::qread() error -

Thanks again for qs; it's been a very helpful tool to date.

Been a while (#8) 👌 since I had issues with qs.

This is the first time I've seen this error message:

> rawData <- qs::qread("my_file.q", use_alt_rep = FALSE)
Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, inspect,  : 
  value of 'SET_ATTRIB' must be a pairlist or NULL, not a 'char'
> rawData <- qs::qread("my_file.q", use_alt_rep = TRUE)
Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, inspect,  : 
  value of 'SET_ATTRIB' must be a pairlist or NULL, not a 'char'
> rawData <- qs::qread("my_file.q", inspect = TRUE)
End of file not reached
Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, inspect,  : 
  File inspection failed

Session info

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    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] qs_0.15.1          data.table_1.12.2  callr_3.3.0        rstan_2.18.2       StanHeaders_2.18.1 tidybayes_1.1.0    brms_2.8.0         Rcpp_1.0.2.2       tictoc_1.0        
[10] janitor_1.2.0      readxl_1.3.1       lubridate_1.7.4    forcats_0.4.0      stringr_1.4.0      dplyr_0.8.3        purrr_0.3.2        readr_1.3.1        tidyr_1.0.0       
[19] tibble_2.1.3       ggplot2_3.2.1      tidyverse_1.2.1    ROracle_1.3-1      DBI_1.0.0         

loaded via a namespace (and not attached):
  [1] backports_1.1.5           plyr_1.8.4                igraph_1.2.4.1            lazyeval_0.2.2            svUnit_0.7-12             RApiSerialize_0.1.0      
  [7] crosstalk_1.0.0           rstantools_1.5.1          inline_0.3.15             digest_0.6.21             htmltools_0.4.0           tibbleColumns_0.2.1      
 [13] rsconnect_0.8.15          fansi_0.4.0               magrittr_1.5              openxlsx_4.1.0            modelr_0.1.4              matrixStats_0.54.0       
 [19] xts_0.11-2                beepr_1.3                 prettyunits_1.0.2         colorspace_1.4-1          rvest_0.3.3               haven_2.1.0              
 [25] crayon_1.3.4              jsonlite_1.6              zeallot_0.1.0             zoo_1.8-5                 glue_1.3.1                gtable_0.3.0             
 [31] clipr_0.6.0               pkgbuild_1.0.3            abind_1.4-5               scales_1.0.0              padr_0.4.2                mvtnorm_1.0-10           
 [37] miniUI_0.1.1.1            xtable_1.8-4              ggstance_0.3.1            foreign_0.8-71            stats4_3.5.1              DT_0.6.2                 
 [43] htmlwidgets_1.5.1         httr_1.4.1                threejs_0.3.1             arrayhelpers_1.0-20160527 ellipsis_0.3.0            pkgconfig_2.0.3          
 [49] loo_2.1.0                 dbplyr_1.4.0              utf8_1.1.4                here_0.1                  tidyselect_0.2.5          rlang_0.4.0              
 [55] reshape2_1.4.3            later_1.0.0.9000          munsell_0.5.0             cellranger_1.1.0          tools_3.5.1               cli_1.1.0                
 [61] generics_0.0.2            pacman_0.5.1              audio_0.1-6               broom_0.5.2               ggridges_0.5.1            rematch2_2.1.0           
 [67] processx_3.4.1            fs_1.3.1                  zip_2.0.1                 packrat_0.5.0             nlme_3.1-140              mime_0.7                 
 [73] xml2_1.2.2                compiler_3.5.1            bayesplot_1.6.0           shinythemes_1.1.2         rstudioapi_0.10.0-9002    curl_4.2                 
 [79] stringi_1.4.3             ps_1.3.0                  Brobdingnag_1.2-6         lattice_0.20-38           Matrix_1.2-17             styler_1.2.0             
 [85] markdown_1.1              shinyjs_1.0               vctrs_0.2.0.9001          stringdist_0.9.5.1        pillar_1.4.2              lifecycle_0.1.0          
 [91] bridgesampling_0.6-0      httpuv_1.5.2              R6_2.4.0                  promises_1.1.0.9000       kapow_0.0.0.9000          gridExtra_2.3            
 [97] rio_0.5.16                colourpicker_1.0          gtools_3.8.1              assertthat_0.2.1          tidystringdist_0.1.4      rprojroot_1.3-2          
[103] withr_2.1.2.9000          shinystan_2.5.0           parallel_3.5.1            hms_0.4.2                 grid_3.5.1                coda_0.19-2              
[109] attempt_0.3.0             snakecase_0.9.2           shiny_1.3.2               base64enc_0.1-3           dygraphs_1.1.1.6   

qs package looks not to support multibyte string path/filename at windows

I'm Japanese and I use R with Rstudio at Windows 10.
qs package always help me, thanks very much. But I found it have problems with filename/path of multibyte string.
I would highly appreciate If multibyte path are supported.

qsave(iris, "あいりす.qs")
list.files()
# "縺ゅ>繧翫☆.qs"   # corrupted text

a <- qread("あいりす.qs") # But I can read it.

dir.create("中間データ")
qsave(iris, "中間データ/あいりす.qs") 
# Error: Failed to open file

Here is my sessionInfo().

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=Japanese_Japan.932  LC_CTYPE=Japanese_Japan.932    LC_MONETARY=Japanese_Japan.932 LC_NUMERIC=C                  
[5] LC_TIME=Japanese_Japan.932    

"Warning: end of file not reached, data may be corrupted"

Hi, I think I found a bug in qs.

qsave for two similar objects did not return any errors.

However, qread for the saved objects gave this error:
"Warning: end of file not reached, data may be corrupted"

How can qsave not return an error, but qread returns an error?

Thanks.

question about multithreading

Hello,
when I am load using qs::read I do not see any multithreading (only one cpu is spining at 100%), should this is expected ?

rpois arguments

In your vignette and tests, you use rpois(100, 5e6) along with rnorm(5e6). The call to rpois is producing only 100 random samples; data.frame won't complain because 100 cleanly recycles into 5e6.

(I doubt this has any influence on the benchmark or results, but the code is inconsistent.)

qs package's c_qsave gives libfuzzer error

Hello,

I used qs package to save all my R data types inside of a testharness and In one of those harnesses when I run the code in presence of the sanitizer and libfuzzer I get the following Issue.

I tried to save the following R Numeric matrix in the qs file.

0.00000
0.00000
0.00000
0.00000
0.00000

It shows there is an issue with the qread function :
c_qsave(SEXPREC*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool, int) /tmp/RtmpshnRLQ/R.INSTALL9e85cfad4d6a/qs/src/qs_functions.cpp:83:73

The complete sanitizer and fuzzer stack trace:

==650655==AddressSanitizer CHECK failed: /build/llvm-toolchain-10-yegZYJ/llvm-toolchain-10-10.0.0/compiler-rt/lib/asan/asan_allocator.cpp:142 "((m->chunk_state)) == ((CHUNK_QUARANTINE))" (0x0, 0x3) #0 0x52ce5e in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x52ce5e) #1 0x54137f in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x54137f) #2 0x4b0b74 in __asan::QuarantineCallback::Recycle(__asan::AsanChunk*) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x4b0b74) #3 0x4b085c in __sanitizer::Quarantine<__asan::QuarantineCallback, __asan::AsanChunk>::DoRecycle(__sanitizer::QuarantineCache<__asan::QuarantineCallback>*, __asan::QuarantineCallback) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x4b085c) #4 0x4b03d6 in __sanitizer::Quarantine<__asan::QuarantineCallback, __asan::AsanChunk>::Recycle(unsigned long, __asan::QuarantineCallback) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x4b03d6) #5 0x4b224e in __asan::Allocator::QuarantineChunk(__asan::AsanChunk*, void*, __sanitizer::BufferedStackTrace*) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x4b224e) #6 0x554cc5 in operator delete(void*) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x554cc5) #7 0x7fdf8bc1cb9a in __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) /usr/include/c++/9/ext/new_allocator.h:128:19 #8 0x7fdf8bc1cb9a in std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long) /usr/include/c++/9/bits/alloc_traits.h:470:9 #9 0x7fdf8bc1cb9a in std::_Vector_base<char, std::allocator<char> >::_M_deallocate(char*, unsigned long) /usr/include/c++/9/bits/stl_vector.h:351:19 #10 0x7fdf8bc1cb9a in std::_Vector_base<char, std::allocator<char> >::~_Vector_base() /usr/include/c++/9/bits/stl_vector.h:332:2 #11 0x7fdf8bc1cb9a in std::vector<char, std::allocator<char> >::~vector() /usr/include/c++/9/bits/stl_vector.h:680:7 #12 0x7fdf8bc1cb9a in CompressBuffer<std::basic_ofstream<char, std::char_traits<char> >, zstd_compress_env>::~CompressBuffer() /tmp/RtmpshnRLQ/R.INSTALL9e85cfad4d6a/qs/src/qs_serialization.h:29:8 #13 0x7fdf8bc1cb9a in c_qsave(SEXPREC*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool, int) /tmp/RtmpshnRLQ/R.INSTALL9e85cfad4d6a/qs/src/qs_functions.cpp:83:73 #14 0x7fdf8bc08b01 in _qs_c_qsave_try(SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*) /tmp/RtmpshnRLQ/R.INSTALL9e85cfad4d6a/qs/src/RcppExports.cpp:557:41 #15 0x56362a in qs::c_qsave(SEXPREC*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool, int) /home/akhila/R/x86_64-pc-linux-gnu-library/4.0/qs/include/qs_RcppExports.h:357:31 #16 0x5625c4 in DeepState_Test_Benchmarking_deepstate_test_chol_LO_test() /home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness.cpp:24:3 #17 0x556ce8 in DeepState_Run_Benchmarking_deepstate_test_chol_LO_test() /home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness.cpp:13:1 #18 0x59a207 in DeepState_RunTestNoFork (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x59a207) #19 0x59a01a in LLVMFuzzerTestOneInput (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x59a01a) #20 0x45f141 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x45f141) #21 0x45e885 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x45e885) #22 0x460b27 in fuzzer::Fuzzer::MutateAndTestOne() (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x460b27) #23 0x461825 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x461825) #24 0x4501de in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x4501de) #25 0x479022 in main (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x479022) #26 0x7fdf94ca60b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16 #27 0x424f7d in _start (/home/akhila/fuzzer_packages/fuzzedpackages/Benchmarking/inst/testfiles/chol_LO/libFuzzer_chol_LO/chol_LO_DeepState_TestHarness+0x424f7d)

qread error with large file

I have a 4Gb R object and saved it to disk with qsave (3.7 Gb in disk), but later could not read it with qread. Playing with the qread parameter does not solve the problem. I am using the latest version of qs.

qs::qsave(x, "x.q")
xx1 <- qs::qread("x.q")
Error in c_qread(normalizePath(file, mustWork = FALSE), use_alt_rep, strict,  : 
  read error

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

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] qs_0.17.3 Seurat_3.0.2 dplyr_0.8.3 colorout_1.2-1

loaded via a namespace (and not attached):
[1] httr_1.4.0 tidyr_0.8.3 jsonlite_1.6
[4] viridisLite_0.3.0 splines_3.6.1 lsei_1.2-0
[7] R.utils_2.9.0 gtools_3.8.1 Rdpack_0.11-0
[10] assertthat_0.2.1 ggrepel_0.8.1 globals_0.12.4
[13] pillar_1.4.2 lattice_0.20-38 reticulate_1.13
[16] glue_1.3.1 digest_0.6.20 RColorBrewer_1.1-2
[19] SDMTools_1.1-221.1 colorspace_1.4-1 cowplot_1.0.0
[22] htmltools_0.3.6 Matrix_1.2-17 R.oo_1.22.0
[25] plyr_1.8.4 pkgconfig_2.0.2 bibtex_0.4.2
[28] tsne_0.1-3 listenv_0.7.0 purrr_0.3.2
[31] scales_1.0.0 RANN_2.6.1 gdata_2.18.0
[34] Rtsne_0.15 RApiSerialize_0.1.0 tibble_2.1.3
[37] ggplot2_3.2.0 withr_2.1.2 ROCR_1.0-7
[40] pbapply_1.4-1 lazyeval_0.2.2 survival_2.44-1.1
[43] magrittr_1.5 crayon_1.3.4 R.methodsS3_1.7.1
[46] future_1.14.0 nlme_3.1-140 MASS_7.3-51.4
[49] gplots_3.0.1.1 ica_1.0-2 tools_3.6.1
[52] fitdistrplus_1.0-14 data.table_1.12.2 gbRd_0.4-11
[55] stringr_1.4.0 plotly_4.9.0 munsell_0.5.0
[58] cluster_2.1.0 irlba_2.3.3 compiler_3.6.1
[61] rsvd_1.0.2 caTools_1.17.1.2 rlang_0.4.0
[64] grid_3.6.1 ggridges_0.5.1 htmlwidgets_1.3
[67] igraph_1.2.4.1 labeling_0.3 bitops_1.0-6
[70] npsurv_0.4-0 gtable_0.3.0 codetools_0.2-16
[73] littleutils_0.1.0 reshape2_1.4.3 R6_2.4.0
[76] gridExtra_2.3 zoo_1.8-6 future.apply_1.3.0
[79] KernSmooth_2.23-15 metap_1.1 ape_5.3
[82] stringi_1.4.3 parallel_3.6.1 Rcpp_1.0.2
[85] sctransform_0.2.0 png_0.1-7 tidyselect_0.2.5
[88] lmtest_0.9-37

Slow initial qread after period without reading

Hello - and thank you for the amazing package. It has generally replaced my usage of readRDS and saveRDS.

I've noticed that after a saving an object with qsave and then reading it a while later the initial read will be substantially slower than subsequent reads. Is this to be expected and is there any way to avoid it? Thanks again.

What setting do you recommend to load file as fast as possible

Hello I'd like to load a save qs file as fast as possible.
What setting do you recommend for that ?
Another question: I usually save lists of data.tables. I have the feeling that when each data.table have list columns loading them is slower, is it something that could be true ?

qs is less efficient than rds in terms of IO for ggplot objects

I'm trying to include some large ggplot2 objects in a Shiny application and some folks suggested that I try out the qs package instead of read/write with base R's .rds.

When I tried benchmarking I ran into unexpected results. It looks like qs is worse in terms of IO than with .rds files (especially when compression = FALSE): link to benchmarking figure

The second issue is that the bench::mark() function causes RStudio to crash - I tried this on the weekend on my 8Gb laptop and then my 32Gb workstation at work today. Wasn't sure if this is a bug that should be reported to your package, their package (or both).

Here's the code I ran:

library(bench)
library(qs)
library(sf)
library(cowplot)

# load ggplot
download.file("https://www.dropbox.com/s/ao0827vayr5u3vx/hawaii_agriculture_100m_basemap.rds?raw=1" , "hawaii_agriculture_100m_basemap.rds")
hawaii <- readRDS("hawaii_agriculture_100m_basemap.rds")

# bench mark saving
save_compressed <- bench::mark(saveRDS(hawaii, "hawaii_compressed.rds"), iterations = 50)
save_uncompressed <- bench::mark(saveRDS(hawaii, "hawaii_uncompressed.rds", compress = FALSE), iterations = 50)
save_qs <- bench::mark(qsave(hawaii, "hawaii.qs"), iterations = 50)

# bench mark reading
read_compressed <- bench::mark(hawaii <- readRDS("hawaii_compressed.rds"), iterations = 50)
read_uncompressed <- bench::mark(hawaii <- readRDS("hawaii_uncompressed.rds"), iterations = 50)
read_qs <- bench::mark(hawaii <- qread("hawaii.qs"), iterations = 50)

# combine
bench_save <- rbind(save_compressed, save_uncompressed, save_qs)
bench_read <- rbind(read_compressed, bench_read_uncompressed, read_qs)

# resort to system.time

# bench mark saving
system.time(saveRDS(hawaii, "hawaii_compressed.rds"))
system.time(saveRDS(hawaii, "hawaii_uncompressed.rds", compress = FALSE))
system.time(qsave(hawaii, "hawaii.qs"))  # this freezes my 8Gb laptop and 32Gb workstation

# bench mark reading
system.time(hawaii <- readRDS("hawaii_compressed.rds"))
system.time(hawaii <- readRDS("hawaii_uncompressed.rds"))
system.time(hawaii <- qread("hawaii.qs"))

plot_01 <- df %>% dplyr::filter(io == "write") %>% ggplot(., aes(x=method, y=time, fill=method)) + 
  geom_bar(stat = "identity") + ggtitle("write time in seconds") + scale_fill_brewer(palette = "Set1") + theme_light() + theme(legend.position="none")

plot_02 <- df %>% dplyr::filter(io == "read") %>% ggplot(., aes(x=method, y=time, fill=method)) + 
  geom_bar(stat = "identity") + ggtitle("read time in seconds") + scale_fill_brewer(palette = "Set1") + theme_light() + theme(legend.position="none")

plot_grid(plot_01, plot_02)

The system.time() function is what I resorted to since I could not get information from {qs} from bench::mark(). Here's my sessionInfo():

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /home/tsundoku/anaconda3/lib/libmkl_rt.so

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8    LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] cowplot_1.0.0  ggplot2_3.2.1  showtext_0.7   showtextdb_2.0 sysfonts_0.8   sf_0.8-0       qs_0.19.1      bench_1.0.4   

loaded via a namespace (and not attached):
  [1] nlme_3.1-141        tsne_0.1-3          bitops_1.0-6        RcppAnnoy_0.0.13    RColorBrewer_1.1-2  httr_1.4.1         
  [7] sctransform_0.2.0   tools_3.6.1         backports_1.1.5     R6_2.4.0            irlba_2.3.3         KernSmooth_2.23-16 
 [13] DBI_1.0.0           uwot_0.1.4          lazyeval_0.2.2      colorspace_1.4-1    withr_2.1.2         npsurv_0.4-0       
 [19] tidyselect_0.2.5    gridExtra_2.3       compiler_3.6.1      plotly_4.9.0        labeling_0.3        Seurat_3.1.1       
 [25] caTools_1.17.1.2    scales_1.0.0        classInt_0.4-2      lmtest_0.9-37       ggridges_0.5.1      pbapply_1.4-2      
 [31] stringr_1.4.0       digest_0.6.22       R.utils_2.9.0       pkgconfig_2.0.3     htmltools_0.4.0     bibtex_0.4.2       
 [37] htmlwidgets_1.5.1   rlang_0.4.1         rstudioapi_0.10     RApiSerialize_0.1.0 zoo_1.8-6           jsonlite_1.6       
 [43] ica_1.0-2           gtools_3.8.1        dplyr_0.8.3         R.oo_1.22.0         magrittr_1.5        Matrix_1.2-17      
 [49] Rcpp_1.0.2          munsell_0.5.0       ape_5.3             reticulate_1.13     lifecycle_0.1.0     R.methodsS3_1.7.1  
 [55] stringi_1.4.3       gbRd_0.4-11         MASS_7.3-51.4       gplots_3.0.1.1      Rtsne_0.15          plyr_1.8.4         
 [61] grid_3.6.1          parallel_3.6.1      gdata_2.18.0        listenv_0.7.0       ggrepel_0.8.1       crayon_1.3.4       
 [67] lattice_0.20-38     splines_3.6.1       SDMTools_1.1-221.1  zeallot_0.1.0       pillar_1.4.2        igraph_1.2.4.1     
 [73] future.apply_1.3.0  reshape2_1.4.3      codetools_0.2-16    leiden_0.3.1        glue_1.3.1          lsei_1.2-0         
 [79] metap_1.1           RcppParallel_4.4.4  data.table_1.12.6   vctrs_0.2.0         png_0.1-7           Rdpack_0.11-0      
 [85] gtable_0.3.0        RANN_2.6.1          purrr_0.3.3         tidyr_1.0.0         future_1.14.0       assertthat_0.2.1   
 [91] rsvd_1.0.2          e1071_1.7-2         class_7.3-15        survival_2.44-1.1   viridisLite_0.3.0   tibble_2.1.3       
 [97] units_0.6-5         cluster_2.1.0       globals_0.12.4      fitdistrplus_1.0-14 ROCR_1.0-7     

qsavem error unexpected end of input 1

Hi there,

I used to use qsavem previously without issues but now somehow it doesn't work, and I don't understand why. The example code that comes with the package works fine, but when using it in an actual pipeline I am getting:

Error in parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], : <text>:2:0: unexpected end of input 1: qsave(savelist, qsavem(file = "/pstore/data/RICZ_SCA/09_CD20-TCB/abundance_expression_ExpA_SCT.qs") ^

The traceback shows:

3. parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], collapse = ", "), ")"))
2. eval(parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], collapse = ", "), ")")))
1. qsavem(file = "/pstore/data/RICZ_SCA/09_CD20-TCB/abundance_expression_ExpA_SCT.qs", seurat, lineages, T.markers, tumor.markers, cluster_DEG_A, cluster_DEG_B, GO_A, GO_B)

What am I doing wrong here?

Thanks,
Vinko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.