R Under development (unstable) (2024-08-17 r87027 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## Testing read_apsim_all function > require(apsimx) Loading required package: apsimx APSIM(X) not found. If APSIM(X) is installed in an alternative location, set paths manually using 'apsimx_options' or 'apsim_options'. You can still try as the package will look into the registry (under Windows) > > run.examples <- FALSE > > extd.dir <- system.file("extdata", package = "apsimx") > > maize.out <- read_apsim("Maize.out", src.dir = extd.dir) > > millet.out <- read_apsim("Millet.out", src.dir = extd.dir) > > ## Running all examples > os <- .Platform$OS.type > > if(os == "windows" && run.examples){ + + apsim_options(warn.versions = FALSE) + ex.classic.dir <- apsimx:::auto_detect_apsim_examples() + apsim.examples <- dir(ex.classic.dir, pattern = "apsim$") + + tmp.dir <- tempdir() + setwd(tmp.dir) + + for(i in apsim.examples){ + if(grepl("\\s", i)) next + file.copy(file.path(ex.classic.dir, i), to = file.path(tmp.dir, i)) + cat("Example:", i) + sim <- try(apsim(file = i, simplify = FALSE), silent = TRUE) + if(inherits(sim, "try-error")){ + cat(" Failed. \n") + next + }else{ + cat("; object class:", class(sim), " ") + cat("; Done. \n") + } + } + } > > proc.time() user system elapsed 0.48 0.17 0.64