View source: R/extract_data_apsimx.R
extract_data_apsimx | R Documentation |
Extract data from a JSON apsimx file.
extract_data_apsimx(
file = "",
src.dir = ".",
node = c("Clock", "Weather", "Soil", "SurfaceOrganicMatter", "MicroClimate", "Crop",
"Manager", "Report", "Operations", "Other"),
soil.child = c("Metadata", "Water", "InitialWater", "Chemical", "Physical", "Analysis",
"SoilWater", "InitialN", "CERESSoilTemperature", "Sample", "Solute", "NO3", "NH4",
"Urea", "Nutrient", "Organic", "Swim3"),
parm = NULL,
digits = 3,
root = NULL
)
file |
file ending in .apsimx to be inspected (JSON) |
src.dir |
directory containing the .apsimx file to be inspected; defaults to the current working directory |
node |
specific node to be used either ‘Clock’, ‘Weather’, ‘Soil’, ‘SurfaceOrganicMatter’, ‘MicroClimate’, ‘Crop’, ‘Manager’, ‘Operations’ or ‘Other’ |
soil.child |
specific soil component to be inspected. The options vary depending on what is available (see inspect_apsimx) |
parm |
parameter to refine the extraction of the ‘manager’ list(‘parm’,‘position’), use ‘NA’ for all the positions. ‘parm’ can be a regular expression for partial matching. |
digits |
number of decimals to print (default 3). Not used now because everything is a character. |
root |
root node label. In simulation structures such as factorials there will be multiple possible nodes. This can be specified by supplying an appropriate character. |
This function does not print anything (compared to inspect_apsimx). The purpose is to return data contained in the APSIM simulation as a data.frame. It will return a ‘list’ when a data frame does not naturally accommodate the result. For example, the complete manager node does not naturally fit into a data frame structure. In some cases, multiple data frames are returned as part of lists.
Have not written this section yet
a data.frame or a list. It does not return a path.
extd.dir <- system.file("extdata", package = "apsimx")
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Clock"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Weather"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "Metadata"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "Physical"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "SoilWater"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "Organic"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "Chemical"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "InitialWater"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Soil",
soil.child = "InitialN"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "SurfaceOrganicMatter"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "MicroClimate"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Crop"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Manager"))
(edf <- extract_data_apsimx("Wheat.apsimx", src.dir = extd.dir, node = "Report"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.