example_path <- function(compression) { system.file("examples", paste0("example_", compression, ".sas7bdat"), package = "anotherSAS7bdat") } wait_for_decoded <- function(reader, rows) { deadline <- Sys.time() + 5 repeat { info <- sas7bdat_info(reader) if (info$rows_decoded >= rows || Sys.time() >= deadline) return(info) Sys.sleep(0.01) } } # Collect rows only for the small dataset generated by the reader check. collect_chunks <- function(path, chunk_rows = 3L, ...) { reader <- sas7bdat_open(path, chunk_rows = chunk_rows, ...) on.exit(sas7bdat_close(reader)) out <- list() repeat { chunk <- sas7bdat_read_chunk(reader) if (is.null(chunk)) break out[[length(out) + 1L]] <- chunk } list(data = if (length(out)) do.call(rbind, out) else NULL, chunks = out, info = sas7bdat_info(reader)) } plain_values <- function(x) { lapply(x, function(col) { if (is.character(col)) as.character(col) else as.numeric(col) }) }