assertive ex 5: reflection

## assertive has some important changes.  Read ?changes for details.

assertive lets you check how you are running R. Try example(is_r) and example(is_windows) to test what version of R you are running and which OS it is running under.

example(is_r)
## 
## is_r> is_r()
## [1] TRUE
## 
## is_r> is_r_stable()
## [1] FALSE
## Cause of failure:  You are running a development build of R, not a stable build. 
## 
## is_r> is_r_patched()
## [1] FALSE
## Cause of failure:  You are running a development build of R, not a patched build. 
## 
## is_r> is_r_devel()
## [1] TRUE
## 
## is_r> is_r_alpha()
## [1] FALSE
## Cause of failure:  You are running a development build of R, not an alpha build. 
## 
## is_r> is_r_beta()
## [1] FALSE
## Cause of failure:  You are running a development build of R, not a beta build. 
## 
## is_r> is_r_release_candidate()
## [1] FALSE
## Cause of failure:  You are running a development build of R, not a release candidate build. 
## 
## is_r> is_architect()
## [1] FALSE
## Cause of failure:  You are not running Architect/StatET. 
## 
## is_r> is_revo_r()
## [1] FALSE
## Cause of failure:  You are not running Revolution R. 
## 
## is_r> is_rstudio()
## [1] FALSE
## Cause of failure:  You are not running RStudio. 
## 
## is_r> is_slave_r()
## [1] TRUE
## 
## is_r> switch(
## is_r+   version$status,
## is_r+   Patched                        = assert_is_r_patched(),
## is_r+   "Under development (unstable)" = assert_is_r_devel(),
## is_r+   alpha                          = assert_is_r_alpha(),
## is_r+   beta                           = assert_is_r_beta(),
## is_r+   RC                             = assert_is_r_release_candidate(),
## is_r+   assert_is_r_stable()
## is_r+ )
## 
## is_r> dont_stop(assert_is_r())
example(is_windows)
## 
## is_wnd> is_windows()
## [1] TRUE
## 
## is_wnd> is_unix()
## [1] FALSE
## Cause of failure:  The operating system is not Unix-based. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows. 
## 
## is_wnd> is_mac()
## [1] FALSE
## Cause of failure:  The operating system is not OS X. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows. 
## 
## is_wnd> is_linux()
## [1] FALSE
## Cause of failure:  The operating system is not Linux. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows. 
## 
## is_wnd> is_bsd()
## [1] FALSE
## Cause of failure:  The operating system is not BSD-based. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows. 
## 
## is_wnd> is_solaris()
## [1] FALSE
## Cause of failure:  The operating system is not Solaris. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows. 
## 
## is_wnd> is_32_bit()
## [1] FALSE
## Cause of failure:  R is not 32 bit. 
## 
## is_wnd> is_64_bit()
## [1] TRUE
## 
## is_wnd> dont_stop(assert_is_windows())
## 
## is_wnd> dont_stop(assert_is_unix())
## <simpleError in assert_is_unix(): The operating system is not Unix-based. R reports it as: Sys.info()['sysname'] = Windows, .Platform$OS = windows.>

Use is_current_r to write some code that prints a message if you are running an out-of-date version of R.

# check for current R here
assert_is_current_r()

Optional extra: Open your user home directory (given by path.expand("~")). Open your user startup file (it’s in this directory, named .Rprofile), or create it if it doesn’t exist. Add your code to this file to get an automatic reminder to upgrade each time you open R.