| Title: | Parse and Query DELTA-Format Taxonomic Descriptions |
|---|---|
| Description: | Provides an R interface to the 'tDelta' C++ library for parsing DELTA (DEscription Language for TAxonomy) format files <https://freedelta.sourceforge.net>. Supports loading character lists, item descriptions, and specifications, with efficient searching and matching of items based on character values. It also supports the generation of identification keys, diagnoses, natural-language descriptions, and clustering and ordination analyses by means of the DELTA programs 'CONFOR', 'KEY', and 'DIST'. |
| Authors: | Mauro Cavalcanti [aut, cre] (Original tDelta C++ library by Denis Ziegler), Edinaldo Nelson dos Santos Silva [ctb] |
| Maintainer: | Mauro Cavalcanti <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-10-28 19:19:58 UTC |
| Source: | https://github.com/cran/RDelta |
Get number of attributes for an item
attribute_count(delta, itemnum)attribute_count(delta, itemnum)
delta |
A DeltaParser object |
itemnum |
Item number |
Integer number of attributes
Get attribute string
attribute_string(delta, itemnum, attrnum)attribute_string(delta, itemnum, attrnum)
delta |
A DeltaParser object |
itemnum |
Item number |
attrnum |
Attribute number |
Character string with the attribute
Get number of characters
char_count(delta)char_count(delta)
delta |
A DeltaParser object |
Integer number of characters
delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) char_count(delta)delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) char_count(delta)
Get character feature
char_feature(delta, charnum)char_feature(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character string with the feature description
delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) char_feature(delta, 1)delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) char_feature(delta, 1)
Get character type
char_type(delta, charnum)char_type(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Integer character type code
Get character type name
char_type_name(delta, charnum)char_type_name(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character string with type name
Get character unit
char_unit(delta, charnum)char_unit(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character string with the unit
Extracts all character definitions from a DELTA dataset and returns them as a data frame.
characters_df(delta)characters_df(delta)
delta |
A DeltaParser object |
A data.frame with character information
Get characters filename
chars_filename(delta)chars_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
This function creates a directives file for the CONFOR program to check the characters and items in a DELTA dataset.
check(delta, remove_temp = TRUE)check(delta, remove_temp = TRUE)
delta |
A Delta dataset object (created by |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Integer: 0 if check is successful, 1 if check fails
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) check(delta) })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) check(delta) })
This function creates a directives file for the CONFOR program to check the characters in a DELTA dataset.
checkc(delta, remove_temp = TRUE)checkc(delta, remove_temp = TRUE)
delta |
A Delta dataset object (created by |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Integer: 0 if check is successful, 1 if check fails
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) checkc(delta) })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) checkc(delta) })
This function creates a directives file for the CONFOR program to check the items in a DELTA dataset.
checki(delta, remove_temp = TRUE)checki(delta, remove_temp = TRUE)
delta |
A Delta dataset object (created by |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Integer: 0 if check is successful, 1 if check fails
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) checki(delta) })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) checki(delta) })
Performs hierarchical cluster analysis on a distance matrix generated by the dist() function. This function reads the distance matrix and item names from the DIST output files and creates a dendrogram.
cluster(notu, method = "average")cluster(notu, method = "average")
notu |
Number of operational taxonomic units (items) in the dataset. |
method |
The agglomeration method to be used. This should be one of "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). Default is "average". |
Invisibly returns a list with the following components:
The hclust object produced by
hclust, which can be further processed or plotted
by the user.
The cophenetic correlation coefficient (a single numeric value between -1 and 1) measuring how faithfully the dendrogram represents the original distance matrix. Values closer to 1 indicate a better fit.
The dist object representing the input distance
matrix.
# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) res <- cluster(delta$get_items_nb()) res$cophenetic res <- cluster(delta$get_items_nb(), method = "complete") })# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) res <- cluster(delta$get_items_nb()) res$cophenetic res <- cluster(delta$get_items_nb(), method = "complete") })
Get all debug output
debug_all(delta)debug_all(delta)
delta |
A DeltaParser object |
Character string with all debug output
Get character type constants
delta_char_types()delta_char_types()
Named integer vector of DELTA character types
Get package version
delta_version()delta_version()
Package version string
Converts a DELTA dataset to SLIKS (Simple List of Interactive Key States) format, which is used for interactive identification keys.
delta2sliks( delta, output_file = "data.js", exclude_numeric = TRUE, remove_temp = TRUE )delta2sliks( delta, output_file = "data.js", exclude_numeric = TRUE, remove_temp = TRUE )
delta |
A DeltaParser object (created by |
output_file |
Output file name (default: "data.js") |
exclude_numeric |
Logical; if TRUE, exclude numeric and text characters |
remove_temp |
Logical; if TRUE, remove temporary files after conversion |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Invisibly returns the path to the output file
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) delta2sliks(delta, output_file = file.path(tempdir(), "data.js")) })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) delta2sliks(delta, output_file = file.path(tempdir(), "data.js")) })
Get all dependent characters
dependent_characters(delta, ccnum, ccstate)dependent_characters(delta, ccnum, ccstate)
delta |
A DeltaParser object |
ccnum |
Control character number |
ccstate |
Control character state |
Integer vector of dependent character numbers
Get number of dependent characters
dependent_count(delta, ccnum, ccstate)dependent_count(delta, ccnum, ccstate)
delta |
A DeltaParser object |
ccnum |
Control character number |
ccstate |
Control character state |
Integer count of dependent characters
This function replicates the DIST command in the DELTA system for generating a distance matrix using Gower's coefficient. It creates the necessary directives files and runs the CONFOR and DIST programs.
dist( delta, heading = NULL, match_overlap = FALSE, minimum_comparisons, phylip_format = FALSE, exclude_items = NULL, exclude_characters = NULL, remove_temp = TRUE )dist( delta, heading = NULL, match_overlap = FALSE, minimum_comparisons, phylip_format = FALSE, exclude_items = NULL, exclude_characters = NULL, remove_temp = TRUE )
delta |
A Delta dataset object (created by |
heading |
Heading for the output (default = NULL, uses heading from specs file) |
match_overlap |
For unordered multistate characters, the contribution of a character to the distance between two items is 0 if the items have any of the values of the character in common (default = FALSE) |
minimum_comparisons |
Minimum number of character comparisons required to calculate the distance between two items (default = ceiling(sqrt(number of included characters))) |
phylip_format |
Causes the taxon names to be interleaved with the rows of the distance matrix, as required by the program Phylip (default = FALSE) |
exclude_items |
A list of items to be excluded (default = NULL) |
exclude_characters |
A list of characters to be excluded (default = NULL) |
remove_temp |
Logical; if TRUE, remove temporary files after conversion |
The function assumes that the CONFOR and DIST program executables are available in the system PATH or in the current working directory.
Invisibly returns 0 on success
# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) dist(delta, match_overlap = TRUE, phylip_format = TRUE, minimum_comparisons = 10) })# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) dist(delta, match_overlap = TRUE, phylip_format = TRUE, minimum_comparisons = 10) })
Find all matching items
find_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)find_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)
delta |
A DeltaParser object |
charnum |
Character number |
values |
Numeric vector of values |
strict |
Logical; strict comparison |
with_extrval |
Logical; include extreme values |
Integer vector of matching item numbers
Find first matching item
first_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)first_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)
delta |
A DeltaParser object |
charnum |
Character number |
values |
Numeric vector of values |
strict |
Logical; strict comparison |
with_extrval |
Logical; include extreme values |
Integer item number or 0 if none
Get all dependent characters
get_all_depchar(delta, ccnum, ccstate)get_all_depchar(delta, ccnum, ccstate)
delta |
A DeltaParser object |
ccnum |
Control character number |
ccstate |
Control character state |
Integer vector of dependent character numbers
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_depchar(delta, 13, 2) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_depchar(delta, 13, 2) })
Get all dependency relationships
get_all_dependencies(delta)get_all_dependencies(delta)
delta |
A DeltaParser object |
List of all dependency relationships
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_dependencies(delta) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_dependencies(delta) })
Get all implicit values
get_all_implicit_values(delta, iv_type = 1)get_all_implicit_values(delta, iv_type = 1)
delta |
A DeltaParser object |
iv_type |
Implicit value type (1 or 2, default: 1) |
Integer vector of implicit values
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_implicit_values(delta) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_all_implicit_values(delta) })
Get attribute string (C++ style)
get_attribute(delta, itemnum, attrnum)get_attribute(delta, itemnum, attrnum)
delta |
A DeltaParser object |
itemnum |
Item number |
attrnum |
Attribute number |
Character string with the attribute
Get number of attributes (C++ style)
get_attributes_nb(delta, itemnum)get_attributes_nb(delta, itemnum)
delta |
A DeltaParser object |
itemnum |
Item number |
Integer number of attributes
Get character feature (C++ style)
get_char_feature(delta, charnum)get_char_feature(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character string with the feature description
Get character type (C++ style)
get_char_type(delta, charnum)get_char_type(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Integer character type code
Get character unit (C++ style)
get_char_unit(delta, charnum)get_char_unit(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character string with the unit
Get character debug output
get_chars_debug(delta)get_chars_debug(delta)
delta |
A DeltaParser object |
Character string with debug output
Get number of characters (C++ style)
get_chars_nb(delta)get_chars_nb(delta)
delta |
A DeltaParser object |
Integer number of characters
Get dependent character by rank (C++ style)
Get dependent character at specific rank
get_depchar(delta, ccnum, ccstate, rank = 1) get_depchar(delta, ccnum, ccstate, rank = 1)get_depchar(delta, ccnum, ccstate, rank = 1) get_depchar(delta, ccnum, ccstate, rank = 1)
delta |
A DeltaParser object |
ccnum |
Control character number |
ccstate |
Control character state |
rank |
Rank position (default: 1) |
Integer dependent character number
Dependent character number or 0 if none
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_depchar(delta, 13, 2, 1) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_depchar(delta, 13, 2, 1) })
Get number of dependent characters (C++ style)
Get number of dependent characters
get_depchar_nb(delta, ccnum, ccstate) get_depchar_nb(delta, ccnum, ccstate)get_depchar_nb(delta, ccnum, ccstate) get_depchar_nb(delta, ccnum, ccstate)
delta |
A DeltaParser object |
ccnum |
Control character number |
ccstate |
Control character state |
Integer count of dependent characters
Number of dependent characters
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_depchar_nb(delta, 13, 2) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_depchar_nb(delta, 13, 2) })
Get example file paths for testing
get_example_files(dataset = "viola")get_example_files(dataset = "viola")
dataset |
Character string: "viola" or "grass" |
List with file paths
Get filename (C++ style)
get_filename(delta)get_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
Get implicit value (C++ style)
Get implicit value for a character
get_implicit_value(delta, charnum, iv_type = 1) get_implicit_value(delta, charnum, iv_type = 1)get_implicit_value(delta, charnum, iv_type = 1) get_implicit_value(delta, charnum, iv_type = 1)
delta |
A DeltaParser object |
charnum |
Character number |
iv_type |
Implicit value type (1 or 2, default: 1) |
Integer implicit value
Integer value or NA if not defined
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_implicit_value(delta, 1) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) get_implicit_value(delta, 1) })
Retrieves all data for a specific item.
get_item(delta, itemnum, include_comments = FALSE)get_item(delta, itemnum, include_comments = FALSE)
delta |
A DeltaParser object |
itemnum |
Integer item number |
include_comments |
Logical; if TRUE, include comments in item names |
A list with item name and attributes
Get item name (C++ style)
get_item_name(delta, itemnum, include_comments = TRUE)get_item_name(delta, itemnum, include_comments = TRUE)
delta |
A DeltaParser object |
itemnum |
Item number |
include_comments |
Logical; if TRUE, include comments in item names |
Character string with item name
Get items debug output
get_items_debug(delta)get_items_debug(delta)
delta |
A DeltaParser object |
Character string with debug output
Get items filename (C++ style)
get_items_filename(delta)get_items_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
Get number of items (C++ style)
get_items_nb(delta)get_items_nb(delta)
delta |
A DeltaParser object |
Integer number of items
Get specifications debug output
get_specs_debug(delta)get_specs_debug(delta)
delta |
A DeltaParser object |
Character string with debug output
Get specifications filename (C++ style)
get_specs_filename(delta)get_specs_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
Get state name (C++ style)
get_state(delta, charnum, statenum)get_state(delta, charnum, statenum)
delta |
A DeltaParser object |
charnum |
Character number |
statenum |
State number |
Character string with state name
Get number of states (C++ style)
get_states_nb(delta, charnum)get_states_nb(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Integer number of states
Get version of the underlying C++ library
get_version(delta)get_version(delta)
delta |
A DeltaParser object |
Version string
Check if specifications are available
has_specifications(delta)has_specifications(delta)
delta |
A DeltaParser object |
Logical
Get implicit value
implicit_value(delta, charnum, iv_type = 1)implicit_value(delta, charnum, iv_type = 1)
delta |
A DeltaParser object |
charnum |
Character number |
iv_type |
Implicit value type (1 or 2) |
Integer implicit value
Get all implicit values
implicit_values(delta, iv_type = 1)implicit_values(delta, iv_type = 1)
delta |
A DeltaParser object |
iv_type |
Implicit value type (1 or 2) |
Integer vector of implicit values
Check if characters are parsed
is_chars_parsed(delta)is_chars_parsed(delta)
delta |
A DeltaParser object |
Logical
Check if character is dependent
Check if a character is dependent
is_dependent(delta, dcnum, ccnum, ccstate) is_dependent(delta, dcnum, ccnum, ccstate)is_dependent(delta, dcnum, ccnum, ccstate) is_dependent(delta, dcnum, ccnum, ccstate)
delta |
A DeltaParser object |
dcnum |
Dependent character number |
ccnum |
Control character number |
ccstate |
Control character state |
Logical indicating if dependent
Logical indicating if dcnum is dependent
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) is_dependent(delta, 14, 13, 2) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) is_dependent(delta, 14, 13, 2) })
Check if items are parsed
is_items_parsed(delta)is_items_parsed(delta)
delta |
A DeltaParser object |
Logical
Check if parsed (C++ style)
is_parsed(delta)is_parsed(delta)
delta |
A DeltaParser object |
Logical
Check if specifications are parsed
is_specs_parsed(delta)is_specs_parsed(delta)
delta |
A DeltaParser object |
Logical
Get item attributes as data frame
item_attributes(delta, itemnum)item_attributes(delta, itemnum)
delta |
A DeltaParser object |
itemnum |
Item number |
Data frame with attributes
Get number of items
item_count(delta)item_count(delta)
delta |
A DeltaParser object |
Integer number of items
delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) item_count(delta)delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) item_count(delta)
Get item data as list
item_data(delta, itemnum, include_comments = FALSE)item_data(delta, itemnum, include_comments = FALSE)
delta |
A DeltaParser object |
itemnum |
Item number |
include_comments |
Logical; if TRUE, include comments in item names |
List with item data
Get item name
item_name(delta, itemnum, include_comments = TRUE)item_name(delta, itemnum, include_comments = TRUE)
delta |
A DeltaParser object |
itemnum |
Item number |
include_comments |
Logical; if TRUE, include comments in item names |
Character string with item name
delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) item_name(delta, 1)delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) item_name(delta, 1)
Get all item names
item_names(delta, include_comments = FALSE)item_names(delta, include_comments = FALSE)
delta |
A DeltaParser object |
include_comments |
Logical; if TRUE, include comments in item names |
Character vector of item names
Extracts all item information from a DELTA dataset and returns it as a data frame.
items_df(delta, include_comments = FALSE)items_df(delta, include_comments = FALSE)
delta |
A DeltaParser object |
include_comments |
Logical; if TRUE, include comments in item names |
A data.frame with item information
Get items filename
items_filename(delta)items_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
This function replicates the KEY command in the DELTA system for generating dichotomous keys. It creates the necessary directives files and runs the CONFOR and KEY programs.
key( delta, heading = NULL, add_character_numbers = FALSE, no_bracketted_key = FALSE, no_tabular_key = TRUE, number_of_confirmatory_characters = 0, treat_characters_as_variable = NULL, use_normal_values = NULL, character_reliabilities = NULL, key_states = NULL, abase = 2, rbase = 1.4, reuse = 1.01, varywt = 0.8, print_width = 80, exclude_items = NULL, exclude_characters = NULL, remove_temp = TRUE )key( delta, heading = NULL, add_character_numbers = FALSE, no_bracketted_key = FALSE, no_tabular_key = TRUE, number_of_confirmatory_characters = 0, treat_characters_as_variable = NULL, use_normal_values = NULL, character_reliabilities = NULL, key_states = NULL, abase = 2, rbase = 1.4, reuse = 1.01, varywt = 0.8, print_width = 80, exclude_items = NULL, exclude_characters = NULL, remove_temp = TRUE )
delta |
A Delta dataset object (created by |
heading |
Heading for the output (default = NULL, uses heading from specs file) |
add_character_numbers |
Character numbers are to be inserted in bracketed keys (default = FALSE) |
no_bracketted_key |
Suppresses the production of a key in the conventional, 'bracketed' format (default = FALSE) |
no_tabular_key |
Suppresses the production of a key in tabular format (default = TRUE) |
number_of_confirmatory_characters |
Number of confirmatory characters that will be sought for each main character in the key (default = 0, maximum = 4) |
treat_characters_as_variable |
A list of characters for which particular attributes are to be treated as 'variable' (default = NULL) |
use_normal_values |
A list of numeric characters for which extreme values are to be ignored and normal values used when translating into other formats (default = NULL) |
character_reliabilities |
A list of the 'reliabilities' of the characters (default = NULL) |
key_states |
A list of numeric character states to be divided into ranges for use as states in identification keys (default = NULL) |
abase |
Sets the base of the logarithmic item abundance scale (default = 2) |
rbase |
Sets the base of the logarithmic character-reliability scale (default = 1.4) |
reuse |
Attempt to minimize the number of different characters used in the key (default = 1.01) |
varywt |
Sets the value of a parameter that determines the treatment of intra-taxon variability in the process of character selection (default = 0.8) |
print_width |
Maximum line length for output of the keys (default = 80) |
exclude_items |
A list of items to be excluded (default = NULL) |
exclude_characters |
A list of characters to be excluded (default = NULL) |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR and KEY program executables are available in the system PATH or in the current working directory.
Invisibly returns the key as a character vector on success
# Requires the CONFOR and KEY executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) key(delta) key(delta, abase = 2, rbase = 1.4, no_tabular_key = TRUE, number_of_confirmatory_characters = 2) })# Requires the CONFOR and KEY executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) key(delta) key(delta, abase = 2, rbase = 1.4, no_tabular_key = TRUE, number_of_confirmatory_characters = 2) })
Create a DeltaParser object from DELTA format files.
load_delta(chars_file, items_file, specs_file = NULL)load_delta(chars_file, items_file, specs_file = NULL)
chars_file |
Path to the DELTA characters file |
items_file |
Path to the DELTA items file |
specs_file |
Optional path to the DELTA specifications file |
A DeltaParser Rcpp module object
# Load the packaged example dataset delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) { char_count(delta) char_feature(delta, 1) }# Load the packaged example dataset delta <- tryCatch( load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ), error = function(e) NULL ) if (!is.null(delta)) { char_count(delta) char_feature(delta, 1) }
Check if item matches values
matches(delta, itemnum, charnum, values, strict = TRUE, with_extrval = TRUE)matches(delta, itemnum, charnum, values, strict = TRUE, with_extrval = TRUE)
delta |
A DeltaParser object |
itemnum |
Item number |
charnum |
Character number |
values |
Numeric vector of values |
strict |
Logical; strict comparison |
with_extrval |
Logical; include extreme values |
Logical indicating if item matches
This function replicates the TRANSLATE INTO NATURAL LANGUAGE command in the DELTA system. It creates the necessary directives file and runs the CONFOR program to generate natural language descriptions.
natlan( delta, heading = NULL, replace_angle_brackets = TRUE, omit_character_numbers = TRUE, omit_inapplicables = TRUE, omit_comments = TRUE, omit_inner_comments = TRUE, omit_final_comma = TRUE, translate_implicit_values = FALSE, omit_lower_for_characters = NULL, omit_or_for_characters = NULL, omit_period_for_characters = NULL, new_paragraphs_at_characters = NULL, item_subheadings = NULL, link_characters = NULL, replace_semicolon_by_comma = NULL, print_width = 80, exclude_items = NULL, exclude_characters = NULL, vocabulary = NULL, remove_temp = TRUE )natlan( delta, heading = NULL, replace_angle_brackets = TRUE, omit_character_numbers = TRUE, omit_inapplicables = TRUE, omit_comments = TRUE, omit_inner_comments = TRUE, omit_final_comma = TRUE, translate_implicit_values = FALSE, omit_lower_for_characters = NULL, omit_or_for_characters = NULL, omit_period_for_characters = NULL, new_paragraphs_at_characters = NULL, item_subheadings = NULL, link_characters = NULL, replace_semicolon_by_comma = NULL, print_width = 80, exclude_items = NULL, exclude_characters = NULL, vocabulary = NULL, remove_temp = TRUE )
delta |
A Delta dataset object (created by |
heading |
Heading for the descriptions (default = NULL, uses heading from specs file) |
replace_angle_brackets |
Replace angle brackets with parentheses (default = TRUE) |
omit_character_numbers |
Omit character numbers from descriptions (default = TRUE) |
omit_inapplicables |
Omit 'or not applicable' from descriptions (default = TRUE) |
omit_comments |
Omit comments in attributes (default = TRUE) |
omit_inner_comments |
Omit inner comments in character list and attributes (default = TRUE) |
omit_final_comma |
Omit final comma before 'and' (default = TRUE) |
translate_implicit_values |
Output implicit values in descriptions (default = FALSE) |
omit_lower_for_characters |
List of numeric characters to omit lower values |
omit_or_for_characters |
List of characters to omit 'or' between alternatives |
omit_period_for_characters |
List of characters where period would normally terminate a sentence |
new_paragraphs_at_characters |
List of characters where new paragraphs should start |
item_subheadings |
List of subheadings for items (delimiter/character/value) |
link_characters |
List of characters specifying how attributes are combined |
replace_semicolon_by_comma |
List of characters to use comma instead of semicolon |
print_width |
Maximum line length for output (default = 80) |
exclude_items |
List of items to exclude |
exclude_characters |
List of characters to exclude |
vocabulary |
List for custom vocabulary (default = NULL) |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Invisibly returns the descriptions as a character vector
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) natlan(delta) natlan(delta, heading = "Flora of Region X - species descriptions", item_subheadings = list( "87" = "Transverse section of lamina", "96" = "Leaf epidermis" )) })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) natlan(delta) natlan(delta, heading = "Flora of Region X - species descriptions", item_subheadings = list( "87" = "Transverse section of lamina", "96" = "Leaf epidermis" )) })
Find next matching item
next_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)next_matching(delta, charnum, values, strict = TRUE, with_extrval = TRUE)
delta |
A DeltaParser object |
charnum |
Character number |
values |
Numeric vector of values |
strict |
Logical; strict comparison |
with_extrval |
Logical; include extreme values |
Integer item number or 0 if none
Parse a DELTA attribute string
parse_attribute(attr_string)parse_attribute(attr_string)
attr_string |
A DELTA attribute string |
A list with parsed components: charnum (integer),
comment (character), and alternatives (list of parsed
value lists).
Parse characters file
parse_characters(delta)parse_characters(delta)
delta |
A DeltaParser object |
Logical indicating success
Parse items file
parse_items(delta)parse_items(delta)
delta |
A DeltaParser object |
Logical indicating success
Parse specifications file
parse_specs(delta)parse_specs(delta)
delta |
A DeltaParser object |
Logical indicating success
Performs principal coordinates analysis (PCoA) on a distance matrix generated by the dist() function. This function reads the distance matrix and item names from the DIST output files and creates a PCoA scatterplot.
pcoa(notu)pcoa(notu)
notu |
Number of operational taxonomic units (items) in the dataset. |
Invisibly returns a list with the following components:
A two-column matrix of the coordinates of the items on the first two principal coordinate axes.
The eigenvalues of the PCoA solution, as returned by
cmdscale.
A numeric vector of length 2 giving the proportion of total variance explained by Axis 1 and Axis 2 (values between 0 and 1).
A single numeric value giving the cumulative proportion of variance explained by the first two axes combined.
The full result object returned by
cmdscale, for users who need access to all
components.
# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) res <- pcoa(delta$get_items_nb()) res$variance res$cumulative })# Requires the CONFOR and DIST executables on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) dist(delta) res <- pcoa(delta$get_items_nb()) res$variance res$cumulative })
This matches the C++ retrieve_all() method from the original tDelta library, combining characters, items, and specifications output.
retrieve_all(delta)retrieve_all(delta)
delta |
A DeltaParser object |
Character string with all debug information
This matches the C++ retrieve_all() method from the original tDelta library.
retrieve_all_chars(delta)retrieve_all_chars(delta)
delta |
A DeltaParser object |
Character string with debug information
This matches the C++ retrieve_all() method from the original tDelta library.
retrieve_all_items(delta)retrieve_all_items(delta)
delta |
A DeltaParser object |
Character string with debug information
This matches the C++ retrieve_all() method from the original tDelta library.
retrieve_all_specs(delta)retrieve_all_specs(delta)
delta |
A DeltaParser object |
Character string with debug information
This function saves a Delta dataset object to disk as three plain text files: "chars", "items", and "specs" in the DELTA format.
save_delta(delta, dir, prefix = "", overwrite = FALSE, width = 79)save_delta(delta, dir, prefix = "", overwrite = FALSE, width = 79)
delta |
A Delta dataset object (Rcpp_DeltaParser from load_delta()) |
dir |
Path to the directory where files should be saved. This argument
is required: the function never writes to the current working directory by
default. Use |
prefix |
Optional prefix for filenames (default: "") |
overwrite |
Whether to overwrite existing files (default: FALSE) |
width |
Maximum line width for output files (default: 79, range: 40-132) |
Invisibly returns the input delta object
try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) # Write to a temporary directory save_delta(delta, dir = tempdir()) # Write to a user-chosen directory with a prefix save_delta(delta, dir = tempdir(), prefix = "my_", overwrite = TRUE) # Use a wider output width save_delta(delta, dir = tempdir(), width = 120) })try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) # Write to a temporary directory save_delta(delta, dir = tempdir()) # Write to a user-chosen directory with a prefix save_delta(delta, dir = tempdir(), prefix = "my_", overwrite = TRUE) # Use a wider output width save_delta(delta, dir = tempdir(), width = 120) })
Set character type
set_char_type(delta, charnum, chartype)set_char_type(delta, charnum, chartype)
delta |
A DeltaParser object |
charnum |
Character number |
chartype |
Integer character type code |
No return value, called for side effects. The character type of
charnum is modified in delta in place.
Set character type by name
set_char_type_by_name(delta, charnum, type_name)set_char_type_by_name(delta, charnum, type_name)
delta |
A DeltaParser object |
charnum |
Character number |
type_name |
Character type name |
No return value, called for side effects. The character type of
charnum is modified in delta in place.
Set characters filename
set_chars_filename(delta, fname, parse = TRUE)set_chars_filename(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The characters filename
stored in delta is updated.
Set filename (C++ style)
set_filename(delta, fname, parse = TRUE)set_filename(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The characters filename
stored in delta is updated.
Set items filename
set_items_file(delta, fname, parse = TRUE)set_items_file(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The items filename stored
in delta is updated.
Set items filename (C++ style)
set_items_filename(delta, fname, parse = TRUE)set_items_filename(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The items filename stored
in delta is updated.
Set specifications filename
set_specs_file(delta, fname, parse = TRUE)set_specs_file(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The specifications
filename stored in delta is updated.
Set specifications filename (C++ style)
set_specs_filename(delta, fname, parse = TRUE)set_specs_filename(delta, fname, parse = TRUE)
delta |
A DeltaParser object |
fname |
New filename |
parse |
Logical, parse the file immediately |
No return value, called for side effects. The specifications
filename stored in delta is updated.
Get specifications filename
specs_filename(delta)specs_filename(delta)
delta |
A DeltaParser object |
Character string with the filename
Get number of states for a character
state_count(delta, charnum)state_count(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Integer number of states
Get state name
state_name(delta, charnum, statenum)state_name(delta, charnum, statenum)
delta |
A DeltaParser object |
charnum |
Character number |
statenum |
State number |
Character string with state name
Get all states for a character
states(delta, charnum)states(delta, charnum)
delta |
A DeltaParser object |
charnum |
Character number |
Character vector of state names
Remove comments from a DELTA string
strip_comments(src)strip_comments(src)
src |
A string with DELTA comments |
A character string with all DELTA comments (delimited by
< and >) removed.
This function creates a directives file for the CONFOR program to generate a statistical summary of characters for a DELTA dataset. The summary includes character types, states, and frequency distributions.
summary(delta, heading = NULL, remove_temp = TRUE)summary(delta, heading = NULL, remove_temp = TRUE)
delta |
A Delta dataset object (created by |
heading |
Heading for the summary (default = NULL, uses heading from specs file) |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Invisibly returns the path to the generated summary file
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) summary(delta) summary(delta, heading = "Genre Viola") })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) summary(delta) summary(delta, heading = "Genre Viola") })
This function creates a directives file for the CONFOR program to generate a list of characters that are not coded (i.e., have no data) in a DELTA dataset. This is useful for identifying missing data and gaps in taxonomic descriptions.
uncoded(delta, heading = NULL, remove_temp = TRUE)uncoded(delta, heading = NULL, remove_temp = TRUE)
delta |
A Delta dataset object (created by |
heading |
Heading for the output (default = NULL, uses heading from specs file) |
remove_temp |
Logical; if TRUE, remove temporary files after conversion (default = TRUE) |
The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.
Invisibly returns the path to the generated uncoded characters file
# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) uncoded(delta) uncoded(delta, heading = "Genre Viola - Missing data report") })# Requires the CONFOR executable on the PATH. try({ delta <- load_delta( system.file("extdata", "chars_viola", package = "RDelta"), system.file("extdata", "items_viola", package = "RDelta"), system.file("extdata", "specs_viola", package = "RDelta") ) uncoded(delta) uncoded(delta, heading = "Genre Viola - Missing data report") })