@@ -23,7 +23,7 @@ update_world = function(worldfile, out_file = NULL, vars, values, veg_parm_ID =
2323 # - vdouble check all the list options work and check var lengths/numbers when needed
2424
2525 # ---------- Check Aguments ----------
26- if (! exists(worldfile )) {stop(noquote(" Input worldfile is required" ))}
26+ # if (!exists(worldfile)) {stop(noquote("Input worldfile is required"))}
2727 if (! file.exists(worldfile )) {stop(noquote(paste0(" No file found at" , worldfile )))}
2828 if (is.null(out_file ) & ! overwrite ) {stop(noquote(" No destination file set by 'out_file' and 'overwrite' is FALSE" ))}
2929 if (file.exists(out_file ) & overwrite == FALSE ) {stop(noquote(paste0(" File '" ,out_file ," ' already exists and 'overwrite' argument is FALSE" )))}
@@ -43,8 +43,9 @@ update_world = function(worldfile, out_file = NULL, vars, values, veg_parm_ID =
4343
4444 # ---------- Parse Worldfile ----------
4545 # parsing the values as characters to retain the exact value/precision
46- read_world = readLines(worldfile )
47- world = strsplit(trimws(read_world ), " \t +" )
46+ read_world = readLines(worldfile , warn = FALSE )
47+ read_world = read_world [nchar(read_world ) > 0 ]
48+ world = strsplit(trimws(read_world ), " \\ s+" )
4849 world = data.frame (matrix (unlist(world ), nrow = length(world ), byrow = T ),stringsAsFactors = FALSE )
4950 names(world ) = c(" values" ," vars" )
5051
0 commit comments