Learn R Programming

ratios (version 1.2.0)

select.VarsElements: select.VarsElements

Description

The function returns a character vector of element abbreviations if the input object contained variables with element abbreviations. Input may be data.frame, matrix, character vector or named numeric. There are two options to use this functions:

  • A) only one object

  • B) with two objects

For A) the function checks for the pattern of element abbreviations, e.g. Al, S, Ca, etc. For B) the function checks for element abbreviations which are present in both objects. E.g. if x = c("Al", "Ba", "Ca") and y = c("Ba", "K", "Th") the return value will be "Ba". The resulting character vector is without duplicated entries, e.g. x = c("N", "P", "S", "S") results into c("N", "P", "S").

Usage

select.VarsElements(x, y, invert = FALSE)

Arguments

x

data.frame, character vector or named numeric containing element abbreviations as variables

y

optional, data.frame, character vector or named numeric containing element abbreviations as variables

invert

logical. If TRUE return variable names that do not match an element abbreviation pattern

Value

character vector of element abbreviations

See Also

Other sub functions: check_readline, relError_dataset

Examples

Run this code
# NOT RUN {
x = c("Al", "Ba", "Ca")
y = c("Ba", "K", "Th")
select.VarsElements(x, y)

myvector = c("Al", "Location", "Date", "S", "Ba", "OH")
select.VarsElements(myvector)
select.VarsElements(myvector, invert = TRUE)

# }

Run the code above in your browser using DataLab