View source: R/simplify_idaifield_resources.R
simplify_idaifield | R Documentation |
1041-1
#' Simplify a List Imported from an iDAI.field / Field Desktop-DatabaseThe function will take a list as returned by
get_idaifield_docs()
, idf_query()
, idf_index_query()
, or
idf_json_query()
and process it to make the list more usable.
It will unnest a few lists, including the dimension-lists and the
period-list to provide single values for later processing with
idaifield_as_matrix()
.
If a connection to the database can be established, the function will
get the relevant project configuration and convert custom checkboxes-fields
to multiple lists, each for every value from the respective valuelist,
to make them more accessible during the conversion with
idaifield_as_matrix()
.
It will also remove the custom configuration field names that are in use
since iDAI.field 3 / Field Desktop and consist of "projectname:fieldName".
Only the "projectname:"-part will be removed.
simplify_idaifield(
idaifield_docs,
keep_geometry = FALSE,
replace_uids = TRUE,
find_layers = TRUE,
uidlist = NULL,
language = "all",
remove_config_names = TRUE,
spread_fields = TRUE,
use_exact_dates = FALSE,
silent = FALSE
)
idaifield_docs |
An |
keep_geometry |
TRUE/FALSE: Should the geographical
information be kept or removed? Defaults is FALSE. Uses: |
replace_uids |
TRUE/FALSE: Should UUIDs be automatically replaced with the
corresponding identifiers? Defaults is TRUE. Uses: |
find_layers |
TRUE/FALSE. Default is FALSE. If TRUE, adds another column
with the 'Layer' (see |
uidlist |
If NULL (default) the list of UUIDs and identifiers is
automatically generated within this function using |
language |
The short name (e.g. "en", "de", "fr") of the language
that is preferred for the fields. Special value "all" (the default) can be
used to return a concatenated string of all available languages.
|
remove_config_names |
TRUE/FALSE: Should the name of the project be
removed from field names of the configuration? (Default is TRUE.)
(Should e.g.: test:amount be renamed to amount,
see |
spread_fields |
TRUE/FALSE: Should checkbox-fields be
spread across multiple lists to facilitate boolean-columns for each value
of a checkbox-field? Default is TRUE. Uses: |
use_exact_dates |
TRUE/FALSE: Should the values from any "exact"
dates be used in case there are any? Default is FALSE. Changes outcome of |
silent |
TRUE/FALSE, default: FALSE. Should messages be suppressed? |
Please note: The function will need an Index (i.e. uidlist as provided
by get_uid_list()
) of the complete project database to correctly replace
the UUIDs with their corresponding identifiers! Especially if a selected
list is passed to simplify_idaifield()
, you need to supply the uidlist
of the complete project database as well.
Formatting of various lists: Dimension measurements as well as dating are reformatted and might produce unexpected results. For the dating, all begin and end values are evaluated and for each resource, the minimum value from "begin" and maximum value from "end" is selected. For the dimension-fields, if a ranged measurement was selected, a mean will be returned.
An idaifield_simple
-list containing the same resources in
a different format depending on the parameters used.
This function uses: idf_sepdim()
, remove_config_names()
When find_layers = TRUE: find_layer()
, this only works when the function can get an index/uidlist!
fix_dating()
with the outcome depending on the use_exact_dates
-argument.
When selecting a language: gather_languages()
Depending on the spread_fields
-argument: convert_to_onehot()
Depending on the keep_geometry
-argument: reformat_geometry()
Depending on the replace_uids
-argument: fix_relations()
with replace_uid()
If uidlist = NULL
: get_uid_list()
## Not run:
connection <- connect_idaifield(serverip = "127.0.0.1",
project = "rtest",
user = "R",
pwd = "hallo")
idaifield_docs <- get_idaifield_docs(connection = connection)
simpler_idaifield <- simplify_idaifield(idaifield_docs)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.