testrwm {rwm} | R Documentation |
Tests that the variable .UserDirectory
has a valid setting.
testrwm()
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
.
Returns TRUE or FALSE according if the setup is valid
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()
.
A.I. McLeod
#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()