diff --git a/R/read_csv.R b/R/read_csv.R index 6021e637b..2fd6cc057 100644 --- a/R/read_csv.R +++ b/R/read_csv.R @@ -203,9 +203,14 @@ read_cmdstan_csv <- function(files, } else if (metadata$method == "optimize") { all_draws <- 1 } + if (os_is_windows()) { + fread_cmd <- paste0("findstr /b /v '#' ", output_file) + } else { + fread_cmd <- paste0("grep -v '^#' ", output_file) + } suppressWarnings( draws <- data.table::fread( - cmd = paste0("grep -v '^#' ", output_file), + cmd = fread_cmd, select = col_select ) ) @@ -380,9 +385,14 @@ read_csv_metadata <- function(csv_file) { csv_file_info <- list() inv_metric_rows <- 0 parsing_done <- FALSE + if (os_is_windows()) { + fread_cmd <- paste0("findstr /b /v '[#a-zA-Z]' ", output_file) + } else { + fread_cmd <- paste0("grep -v '^#' ", output_file) + } suppressWarnings( metadata <- data.table::fread( - cmd = paste0("grep '^[#a-zA-Z]' ", csv_file), + cmd = fread_cmd, colClasses = "character", stringsAsFactors = FALSE, fill = TRUE,