diag_idea.Rd
This is a wrapper function designed to compute a complete IDEA4 diagnosis with a single function. According to the user's input, functions from IDEATools will be sequentially called to produce the desired output.
diag_idea( input, output_directory, type = "single", export_type = c("report", "local"), plot_choices = c("dimensions", "trees", "radars"), report_format = "pdf", prefix = NULL, dpi = 320, append = FALSE, quiet = FALSE )
input | a character vector with path names to a single file, multiple files or even a directory with IDEA data. File extensions can either be |
---|---|
output_directory | the output directory for the rendered reports and/or plots. Defaults to "IDEATools_output" |
type | the type of analysis to perform. Can be "single" for single farm-related results, "group" for group-related results, or even both c("single","report"), provided that the number of farms is at least 3. |
export_type | the type of output to produce. Can be either "report" to produce compiled reports and/or "local" to write raw plots. If NULL, the algorithm will not produce any plots on machine and will return a list with the IDEA results. |
plot_choices | the type of plots to be produced. Can be either "dimensions", "trees" or "radars" or a combination of these 3. Ignored if the export type is "report". |
report_format | a string indicating the output format if |
prefix | a prefix which will be added to output files names. Typically, the name of the farm. Ignored if |
dpi | ggplot output resolution. |
append | In the case of a single excel report and if the input is an xlsx file, should the results be appended to the original file ? |
quiet | A command to remove console printing. |
Either reports and/or raw plots in output_directory
or a named list with all the results.
This function is designed to provide the user a single function to use for a full IDEA4 diagnosis.
If the input is a single file, then a simple "read_idea() %>% compute_idea() %>% plot_idea() %>% write_idea()
" or "old_idea() %>% plot_idea() %>% write_idea()
" pipeline will be used. If export_type is NULL, then the output of plot_idea()
will be returned.
If the input is a list of files and/or a directory, and if type is "single", then the single analysis pipelines are iterated over each file. If export_type is NULL, then the multiple outputs of plot_idea()
are gathered in an unique list and returned.
If the input is a list of files and/or a directory, and if type is "group", then the "import" (read_idea() %>% compute_idea()
or old_idea()
) pipeline is iterated over each file and the results are gathered in an object of class "IDEA_group_data". This object introduced in the plot_idea() %>% write_idea()
pipeline will trigger a new algorithm suited to group analysis. If export_type is NULL, then the output of plot_idea()
will be returned.
Note that group analysis requires a number of unique farms greater or equal to 3.
library(IDEATools) path <- system.file("idea_example.json", package = "IDEATools") if (FALSE) { # Find your temporary directory tempdir <- tempdir() # Run a full individual diagnosis with local export, without radars diag_idea( input = path, output_directory = tempdir, type = "single", export_type = "local", prefix = "Exploitation_A", dpi = 300, plot_choices = c("dimensions", "trees"), quiet = FALSE ) # Run a full individual diagnosis with report export as pdf diag_idea( input = path, output_directory = tempdir, type = "single", export_type = "report", prefix = "Exploitation_A", dpi = 300, report_format = "pdf", quiet = FALSE ) }