DwCGeneric | R Documentation |
R6 class representing a generic data structure for a Darwin Core archive file
R6Class
object.
The DwcGeneric
class serves a base class to all Darwin Core archive file types. This class supports all kinds of Darwin Core
archive files but may miss some of the specialised functionality of the more specialist classes.
See https://dwc.tdwg.org/terms/the Darwin core reference guide for more information on Darwin core classes and the terms
supported by them.
setTableName()
Set the name of the file that the data will print to when preparing the Darwin core archive
DwCGeneric$setTableName(inTableName)
inFileName
A character scalar giving the name to give the data file in a Darwin core archive
getTableName()
Retrieve the name of the file that the data will print to when preparing the Darwin core archive
DwCGeneric$getTableName()
The name currently set as the file name in the output archive
importDataTable()
Import data from a data.frame
into a DwCGeneric
object
DwCGeneric$importDataTable(objectData, idColumnInfo, ...)
objectData
A data.frame
containing the data to import into the object
idColumnInfo
Either a character
scalar containing the column name
of objectData
or an integer
scalar giving the index of the column of
objectData
that corresponds to the ID variable
...
A named set of parameter corresponding to Darwin core terms associated
with the DwCGeneric class type. Each is either a a character
scalar containing
the column name of objectData
or an integer
scalar giving the index of
the column of objectData
that corresponds to the term
new()
Create a new DwCGeneric object
DwCGeneric$new( classTermInfo, associatedTerms, objectData, idColumnInfo, nameAutoMap = FALSE, defDateFormat = "YYYY-MM-DD", ... )
classTermInfo
A DwCTerm
object containing the term information for the class
associatedTerms
A list
of DwCTerm
objects that contain all the terms associated with the class
objectData
A data.frame
containing the data to import into the object
idColumnInfo
Either a character
scalar containing the column name
of objectData
or an integer
scalar giving the index of the column of
objectData
that corresponds to the ID variable
nameAutoMap
A logical
scalar that if TRUE
maps the columns of objectData
to their respective Darwin core terms based on the column names
defDateFormat
A character
scalar providing the default format for strings denoting dates in the
data table. See the https://dwc.tdwg.org/text/#1-introductionDarwin Core text guide for expected values
for this string.
...
A named set of parameter corresponding to Darwin core terms associated
with the DwCGeneric class type. Each is either a a character
scalar containing
the column name of objectData
or an integer
scalar giving the index of
the column of objectData
that corresponds to the term
A new DwCGeneric
object
getDwCClassName()
Retrieve the name of the class used in Darwin core
DwCGeneric$getDwCClassName()
A character
scalar contining the name of the Darwin core class
getDwCTermInfo()
Retrieve the term information of thee Darwin core class of the object
DwCGeneric$getDwCTermInfo()
A DwCTerm
object containing the term information of the Darwin core class
of the object
getTermMapping()
Retrieve the mapping information of the Darwin core terms associated with the class to the columns in the data table
DwCGeneric$getTermMapping()
A data.frame
with one row for each Darwin core term associated with the object's
class with two columns: columnIndex
containing the column index of the associated term in the
table and columnName
containg the name of the column
getAssociatedTerms()
Retrieve the terms associated with the Darwin core class of the object
DwCGeneric$getAssociatedTerms()
A list
of DwCTerm
objects containing the term information
Print object to console
print()
Print the term information
DwCGeneric$print()
exportAsDataFrame()
Export the data contained in the table as a data.frame
DwCGeneric$exportAsDataFrame()
A data.frame
of the object's table data
exportTable()
Export the table as a text file
DwCGeneric$exportTable( fileName, append = FALSE, quote = TRUE, sep = "\t", eol = "\n", na = "NA", dec = ".", qmethod = "escape", fileEncoding = "", renameMapped = FALSE )
fileName
Either a character
string naming a file or a connection open for writing.
""
indicates to the console.
append
A logical
scalar. Only relevant if fileName
is a character
string. If
TRUE
, the output is appended to the file. If FALSE
, any existing file of the name is
destroyed.
quote
A logical
scalar or a numeric
vector. If TRUE
, any character or factor
columns will be surrounded by double quotes. If a numeric
vector, its elements are taken as the
indeces of columns to quote. In both cases, row and column names are quoted if they are written. If FALSE
,
nothing is quoted.
sep
The field seperator stirng. Values within each row are separated by this string.
eol
The character(s) to print at the end of each line (row).
na
The string to use for missing values in the data.
dec
The string to use for decimal points in numeric or complex columns: must be a single character
qmethod
A character string specifying how to deal with embedded double quote characters when
quoting strings. Must be one of "escape"
, in which case the quote character is escaped in C style by a
backslash, or "double"
, in which case it is doubled
fileEncoding
A character string. If non-empty, declares the encoding to be used on a file so the character data can be re-encoded as they are written
renameMapped
A logical
scalar that, if TRUE
, replaces mapped column names with their Darwin
core versions
getIDIndex()
Retrieve the column index in the dataset that refers to the unique ID in the dataset
DwCGeneric$getIDIndex()
An integer
scalar giving the index of the column that refers to the unique dataset IDs
getIDName()
Retrieve the column name in the dataset that refers to the unique ID in the dataset
DwCGeneric$getIDName()
A character
scalar giving the column name that refers to the unique dataset IDs
setDefaultYearFormat()
Set the default date format in the dataset
DwCGeneric$setDefaultYearFormat(detDateFormat)
detDateFormat
A character
scalar providing the default format for strings denoting dates in the
data table. See the https://dwc.tdwg.org/text/#1-introductionDarwin Core text guide for expected values
for this string.
getDefaultYearFormat()
Retrieve the default date format
DwCGeneric$getDefaultYearFormat()
A character
scalar containing the default date format
getTableTermName()
Retrieve the term name for the table
DwCGeneric$getTableTermName()
A character
scalar containing the name to the term defining the table
clone()
The objects of this class are cloneable with this method.
DwCGeneric$clone(deep = FALSE)
deep
Whether to make a deep clone.
DwCTerm
DwCTerm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.