testrwm {rwm}R Documentation

Test setup for rwm package

Description

Tests that the variable .UserDirectory has a valid setting.

Usage

testrwm()

Details

Returns TRUE if all of the following are true. First that .UserDirectory is set and second that it is set to a valid directory. Second .UserDate must be set to valid directory name. Third either the directory specificed by .UserDirectory <> .UserDate exists or the base function dir.create is successful in creating it.

Uses base R functions exists, file.exists and dir.create.

Value

Returns TRUE or FALSE according if the setup is valid

Note

This function is used by most of the other functions to validate the setup before attempting to run. The global variable .UserDirectory may be set manually as in the examples below and it can be set by running initrwm().

Author(s)

A.I. McLeod

See Also

loadws, savews, initrwm

Examples

#INITIALIZATION
#Normally .UserDirectory and .UserDate are defined previously. 
#Usually a more convenient directory is used but for illustration
#using a script which will run in interactive or batch mode on any computer:
.UserDirectory <- tempdir()
.UserDate <- "2008"
dir.create(paste(.UserDirectory, .UserDate, sep="/"))

# Example 1: test the above setup is valid
testrwm()

#Example 2: .UserDirectory is not set
rm(.UserDirectory)
testrwm()

[Package rwm version 1.35 Index]