Created
February 18, 2020 16:13
-
-
Save ha0ye/a3cd0fab4bb326f0a3798ffc22155889 to your computer and use it in GitHub Desktop.
read in param output from text file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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