Learn R Programming

linear.tools (version 1.3.0)

check_names_delete: check whether list names (tobechecked) is within specified sets ('checking')

Description

check whether list names (tobechecked) is within specified sets ('checking')

Usage

check_names_delete(tobechecked, checking, STOP = TRUE, tobechecked_name = "tobechecked", checking_name = "checking", default_value = NULL, PRINT = TRUE)

Arguments

tobechecked
a named list / character vector to be checked
checking
a character vector, the names in `tobechecked` is supposed to show up here.
STOP
STOP if there are names in `tobechecked` not showing up in `checking`. If FALSE, then we will delete the names not showing up in `checking`.
tobechecked_name
a character, name of 'tobechecked' for printing.
checking_name
a character, name of 'checking' for printing.
default_value
value to be returned if all names in tobechecked are not in 'checking'.
PRINT
whether print diagnostic information.

Value

a 'purified' named list / character vector , with all names not showing up in `checking` deleted.

Examples

Run this code

tobechecked = list('cut' = 1, 'dwewsdfds' = 2); checking = 'cut'

result =   check_names_delete(tobechecked, checking, STOP = FALSE,
                              tobechecked_name = 'focus_var',
                              checking_name = 'all_raw_vars')
result

result = check_names_delete(tobechecked, checking, STOP = FALSE)
result

tobechecked = c('cut', 'dsfsf'); checking = 'cut'
result = check_names_delete(tobechecked, checking, STOP = FALSE)
result

Run the code above in your browser using DataLab