Rdocumentation
powered by
Learn R Programming
⚠️
There's a newer version (0.3-6) of this package.
Take me there.
assertive (version 0.2-6)
Readable Check Functions to Ensure Code Integrity
Description
Lots of is_* functions to check the state of your variables, and assert_* functions to throw errors if they aren't in the right form.
Copy Link
Link to current version
Version
Version
0.3-6
0.3-5.1
0.3-5
0.3-4
0.3-3
0.3-2
0.3-1
0.3-0
0.2-6
0.2-4
0.2-1
0.1-8
0.1-7
0.1-4
Install
install.packages('assertive')
Monthly Downloads
299
Version
0.2-6
License
Unlimited
Maintainer
Richard Cotton
Last Published
June 24th, 2015
Functions in assertive (0.2-6)
Search all functions
has_any_attributes
Does the input have any attributes?
assert_all_are_empty_files
Is a file empty?
are_identical
Are the inputs identical
assert_has_cols
Does the input have rows/columns?
as.character.file
Convert file connections to strings
assert_is_a_non_empty_string
Is the input of type character?
assert_is_data.frame
Checks to see if the input is a data.frame.
character_to_list_of_integer_vectors
Convert a character vector to a list of integer vectors.
assert_all_are_uk_postcodes
Is the string a valid UK postcode?
assert_all_are_dirs
Is the path a directory? Checks to see if the input path is a directory.
create_regex
Create a regex from components.
are_same_length
Are the inputs the same length
assert_is_function
Is the input a function?
coerce_to
Coerce variable to a different class.
assert_is_binding_locked
Is the binding of a variable locked?
assert_engine
Throws an error if a condition isn't met.
dont_stop
Run code without stopping
not_this_os
Failure for bad OS
false
FALSE, with a cause of failure.
assert_is_qr
Is the input a QR decomposition of a matrix?
has_arg
Does the current call have an argument?
assert_has_dims
Does the input have dimensions?
assert_is_symmetric_matrix
Is the input a symmetric matrix?
assertive
Readable check functions to ensure code integrity.
assert_has_duplicates
Does the input have duplicates?
assert_has_colnames
Does the input have names?
DIM
Get the dimensions of an object
d
Create regex for repeated digits
assert_is_call
Is the input a language object?
assert_all_are_credit_card_numbers
Does the character vector contain credit card numbers?
assert_all_are_imaginary
Is the input real/imaginary?
assert_all_are_hex_colors
Does the character vector contain hex colors?
assert_is_list
Is the input a list?
assert_all_are_libraries
Is the directory a known R library?
assert_all_are_classes
Is the input the name of a (formally defined) class?
assert_all_are_nan
Is the input (not) NaN?
strip_invalid_chars
Removes invalid characters from a string.
assert_all_are_on_os_path
Is the path on the OS path?
assert_is_leaf
Is the input a (dendrogram) leaf?
assert_is_bzfile_connection
Is the input a connection?
assert_all_are_ip_addresses
Does the character vector contain IP addresses?
assert_has_all_attributes
Does the input have the specified attributes?
assert_all_are_executable_files
Is the file accessible?
assert_all_are_us_zip_codes
Is the string a valid US zip code?
assert_all_are_finite
Are the inputs (in)finite?
assert_all_are_cas_numbers
Does the character vector contain CAS registry numbers?
assert_is_a_raw
Is the input raw?
assert_r_has_jpeg_capability
Does R have a capability?
assert_all_are_date_strings
Does the character vector contain dates?
assert_is_empty_model
Is the input the empty model?
assert_is_comma_for_decimal_point
What does the current locale specify for the decimal point?
assert_has_elements
Is the input empty/scalar?
call_and_name
Call a function, and give the result names.
assert_all_are_isbn_codes
Does the character vector contain ISBN book codes?
get_name_in_parent
Get the name of a variable in the parent frame.
assert_is_a_bool
Is the input logical?
merge_dots_with_list
Merge ellipsis args with a list.
bapply
Wrapper to vapply that returns booleans.
assert_all_are_not_na
Is the input present/missing?
assert_is_all_of
Alternative version of is.
assert_all_are_email_addresses
Does the character vector contain email addresses?
is_honorific
Is the string an honorific?
use_first
Only use the first element of a vector.
is_error_free
Does the code run without throwing an error?
assert_is_loaded
Is the input DLL loaded?
assert_is_inherited_from
Does the object inherit from some class?
assert_is_array
Is the input an array or matrix?
locale_categories
Allowed locale categories.
assert_is_a_complex
Is the input complex?
assert_all_are_divisible_by
Is the input divisible by a number?
assert_is_raster
Is the input a raster?
assert_is_not_null
Is the input (not) null?
assert_all_are_single_characters
Is the input a single character?
cause
Get or set the
"cause"
attribute.
assert_is_atomic
Is the input atomic/recursive/vector?
assert_has_terms
Does the input have terms?
parenthesize
Wrap a string in brackets
assert_is_architect
Are you running R?
is_relistable
Is the input relistable?
print_and_capture
Print a variable and capture the output
assert_all_are_uk_telephone_numbers
Is the string a valid UK telephone number?
assert_all_are_existing
Does the variable exist?
assert_is_unsorted
Is the input unsorted?
assert_is_factor
Is the input an factor?
assert_all_are_uk_car_licences
Is the string a valid UK car licence plate number?
assert_all_are_in_closed_range
Is the input in range?
assert_is_mts
Is the input a time series?
assert_all_are_false
Is the input TRUE?
assert_all_are_in_future
Is the input in the past/future?
strip_attributes
Strip all attributes from a variable.
assert_is_an_integer
Is the input an integer?
type_description
Describe the type of object
assert_all_are_us_telephone_numbers
Is the string a valid US telephone number?
is_valid_r_code
Is the input valid R code?
assert_is_if_condition
Is suitable to be used as an if condition
matches_regex
Does the input match the regular expression?
na
NA, with a cause of failure.
assert_is_batch_mode
How is R running?
assert_is_S4
Is the input an S4 object?
assert_is_64_bit_os
What OS is running?
assert_is_current_r
Is this version of R up to date?
assert_all_are_valid_variable_names
Is the string a valid variable name?
assert_all_are_uk_national_insurance_numbers
Is the string a valid UK national insurance number?
assert_are_set_equal
Set comparisons
merge.list
Merge two lists
warn_about_file.access_under_windows
Warn about file.access under Windows
assert_is_environment
Is the input an environment?
truncate
Truncate a string
assert_all_numbers_are_whole_numbers
Is the input a whole number?
assert_r_can_find_tools
Can R find tools?
set_cause
Set a cause and return the input
assert_is_table
Is the input a table?
recycle
Recycle arguments
not_this_build
Failure for bad build
n_elements
Get the number of elements
sys_get_locale
Get or set the system locale
assert_all_are_existing_files
Does the file exist?
assert_is_a_number
Is the input numeric?
assert_is_debugged
Is the input function being debugged?
modal_value
The most common value in a vector.