Assertions for Checking the State of R

A set of predicates and assertions for checking the state and capabilities of R, the operating system it is running on, and the IDE being used. This is mainly for use by other package developers who want to include run-time testing features in their own packages. End-users will usually want to use assertive directly.

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Is the package on CRAN? SemaphoreCI Build Status AppVeyor Build Status

A set of predicates and assertions for checking the state and capabilities of R, the operating system it is running on, and the IDE being used. Most of the documentation is on the assertive page. End-users will usually want to use assertive directly.


To install the stable version, type:


To install the development version, you first need the devtools package.


Then you can install the assertive.reflection package using



There are checks for

Whether you are running R (or an old S-PLUS): is_r.

Your operating system: is_windows, is_unix, is_linux, is_mac, is_solaris.

Your IDE: is_architect, is_rstudio, is_revo_r. Further, for RStudio, you have is_rstudio_desktop, is_rstudio_server.

R's capabilities: r_has_png_capability, r_has_tcltk_capability, etc., for each of the values returned by base::capabilities().

32/64 bit R: is_32_bit, is_64_bit.

How you are running R: is_batch_mode, is_interactive, is_r_slave.

What type of R you are running: is_r_release, is_r_patched, is_r_devel, is_r_alpha, is_r_beta, is_r_release_candidate.

Whether your software is up to date: is_r_current, is_package_current, is_rstudio_current.

What you use for a (numeric or monetary) decimal point: is_comma_for_decimal_point, is_period_for_decimal_point.

Whether a file or directory is on the OS search path: is_on_os_path.


Predicates that return a vector have two corresponding assertions. For example, is_on_os_path has assert_all_are_on_os_path and assert_any_are_on_os_path.

Predicates returning a single logical value have one corresponding assertion. For example, is_r has assert_is_r.


sys_get_locale and sys_set_locale are convenience wrappers to Sys.getlocale and Sys.setlocale respectively.


0.0-4 Added is_macos_sierra & fixed other is_osx_* fns. Made sys_get_locale more robust across different OSes. Added is_visual_studio, is_emacs. is_current_package now vectorised (slight breaking change). Fixed is_rstudio_desktop and is_rstudio_server. 0.0-3 Added is_r_revised. Better handling of bad pkg names in is_package_current. 0.0-2 Added r_can_find_java. Fixed is_rstudio_desktop, is_rstudio_server. Dropped devtools suggestion. 0.0-1 Content extracted from assertive 0.3-0, and tidied.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.0-4 by Richard Cotton, 2 years ago

Report a bug at

Browse source code at

Authors: Richard Cotton [aut, cre]

Documentation:   PDF Manual  

GPL (>= 3) license

Imports assertive.base, utils

Suggests testthat

Imported by assertive, pathological.

See at CRAN