Learn R Programming

PeriodicTable (version 0.1.2)

atomRecognition: 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 values as dummy atoms or not.

na.action

a logical value or NA. NA values will be set to this value.

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.

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.

See Also

atomNames, periodicTable, atomProperties, match

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab