Skip to content

Commit 5a13c0d

Browse files
committed
replace vroom for write and replace vroom in DESCRIPTION
1 parent cc32b93 commit 5a13c0d

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Imports:
2929
posterior (>= 0.1.0),
3030
processx,
3131
R6 (>= 2.4.0),
32-
vroom
32+
data.table
3333
Suggests:
3434
bayesplot,
3535
knitr,

R/data.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,22 @@ process_fitted_params <- function(fitted_params) {
162162
paths <- file.path(tempdir(), paths)
163163
chain <- 1
164164
for (path in paths) {
165-
chain_draws <- posterior::as_draws_df(posterior::subset_draws(draws, chain = chain))
166-
colnames(chain_draws) <- unrepair_variable_names(variables)
165+
chain_draws <- posterior::subset_draws(draws, chain = chain)
166+
unname(chain_draws)
167167
write(
168168
paste0("# num_samples = ", iterations),
169+
file = path
170+
)
171+
write(
172+
paste0(unrepair_variable_names(variables), collapse = ","),
169173
file = path,
170-
append = FALSE
174+
append = TRUE
171175
)
172-
vroom::vroom_write(
176+
utils::write.table(
173177
chain_draws,
174-
delim = ",",
175-
path = path,
176-
col_names = TRUE,
177-
progress = FALSE,
178+
file = path,
179+
sep = ",",
180+
col.names = FALSE,
178181
append = TRUE
179182
)
180183
chain <- chain + 1

R/read_csv.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ read_cmdstan_csv <- function(files,
121121
col_types <- NULL
122122
col_select <- NULL
123123
not_matching <- c()
124-
vroom_warnings <- 0
125-
126124
for (output_file in files) {
127125
if (is.null(metadata)) {
128126
metadata <- read_csv_metadata(output_file)

tests/testthat/test-data.R

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,9 @@ test_that("process_fitted_params() works if output_files in fit do not exist", {
8181
chain <- 1
8282
for(file in new_files) {
8383
suppressWarnings(
84-
tmp_file_gq <- vroom::vroom(
85-
file,
86-
comment = "#",
87-
delim = ',',
88-
trim_ws = TRUE,
89-
altrep = FALSE,
90-
progress = FALSE,
91-
skip = 1)
84+
tmp_file_gq <- data.table::fread(
85+
cmd = paste0("grep -v '^#' ", file)
86+
)
9287
)
9388
tmp_file_gq <- posterior::as_draws_array(tmp_file_gq)
9489
expect_equal(

0 commit comments

Comments
 (0)