Skip to content

Commit

Permalink
Fix bug which returned -1 draws
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBronder committed Nov 3, 2023
1 parent 3cab26a commit 204f217
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,13 @@ read_cmdstan_csv <- function(files,
draws_list_id <- length(draws) + 1
warmup_draws_list_id <- length(warmup_draws) + 1
if (metadata$method == "pathfinder") {
variables = union(metadata$sampler_diagnostics, metadata$variables)
metadata$variables = union(metadata$sampler_diagnostics, metadata$variables)
variables = union(metadata$sampler_diagnostics, variables)
}
suppressWarnings(
draws[[draws_list_id]] <- data.table::fread(
cmd = fread_cmd,
select = variables,
select = metadata$variables,
data.table = FALSE
)
)
Expand Down Expand Up @@ -456,7 +457,7 @@ read_cmdstan_csv <- function(files,
if (length(draws) == 0) {
pathfinder_draws <- NULL
} else {
pathfinder_draws <- do.call(as_draws_format, list(draws[[1]][-1, colnames(draws[[1]]), drop = FALSE]))
pathfinder_draws <- do.call(as_draws_format, list(draws[[1]][, colnames(draws[[1]]), drop = FALSE]))
posterior::variables(pathfinder_draws) <- repaired_variables
}
list(
Expand Down

0 comments on commit 204f217

Please sign in to comment.