atomRecognition {PeriodicTable} | R Documentation |
Atom Recognition
Description
Determine atomic symbols from atom names or atomic numbers.
Usage
symb(x, na.as.dummy = FALSE)
areSymb(x, na.action = FALSE)
isSymb(x, na.action = FALSE)
Arguments
x |
an R object for which to determine atomic symbols or to be tested. |
na.as.dummy |
a logical value. Whether to consider |
na.action |
a logical value or |
Details
In some files, atom names/types are specified instead of atomic symbols. It
is then useful to convert atom names/types into atomic symbols. The
symb
function allow to perform this convertion by using the
atomNames
and periodicTable
data sets.
Atom recognition from character vector is performed as follow:
Remove numbers from character strings.
Search for matching atom types in
atomNames
dataset.Truncate to first character and translate to upper case.
Search for matching atomic symbols in
periodicTable
dataset.Unrecognized atoms are considered as dummy atoms (
"Xx"
).
Function symb
can also convert atomic numbers into atomic symbols.
Atomic numbers are first checked to be whole numbers and then searched into
the periodicTable
dataset to determine atomic symbols.
Function areSymb
can be used to check if the values in a vector are
atomic symbols.
Function isSymb
can be used to check if all the
values in a vector are atomic symbols.
Value
symb
returns a character vector containing atomic symbols.
areSymb
returns a logical vector. isSymb
returns TRUE if
x
contains only atomic symbols or FALSE
otherwise.
See Also
atomNames
, periodicTable
,
atomProperties
, match
Examples
# Display atomNames
data(atomNames)
atomNames
# Get atomic symbols from atom names
symb(c("CA", "CB", "N", "NZ", "OXT"))
# Get atomic symbols from atomic numbers
symb(1:4)