Skip to content

Instantly share code, notes, and snippets.

@ha0ye
Created February 18, 2020 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ha0ye/a3cd0fab4bb326f0a3798ffc22155889 to your computer and use it in GitHub Desktop.
Save ha0ye/a3cd0fab4bb326f0a3798ffc22155889 to your computer and use it in GitHub Desktop.
read in param output from text file
full_text <- readLines(file, warn = FALSE)
start_par_line <- grep("^\\$par", full_text)
start_objective_line <- grep("^\\$objective", full_text)
param_lines <- seq(from = start_par_line,
to = start_objective_line - 3,
by = 2)
params <- purrr::map_dfc(param_lines, function(line_idx)
{
readr::read_delim(file, delim = " ",
skip = line_idx, n_max = 1,
trim_ws = TRUE)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment