Next: getfilename() Up: MacAnova Help File Previous: getascii()   Contents

getdata()

Usage:
y <- getdata(setName), where setName is the unquoted or quoted name of a
  data set in the file whose name is in variable DATAFILE



Keywords: files, variables, input
getdata() is a pre-defined macro to retrieve named data sets from a file
whose name is in CHARACTER scalar DATAFILE.  Specifically,
    y <- getdata(DataName)
is equivalent to
    y <- matread(DATAFILE,"DataName")

The data set name optionally may be a quoted string, but may not be a
CHARACTER variable.

The file whose name is in DATAFILE must be in the form readable by
matread().  See matread() and topic 'matread_file'.

y <- getdata(DataName,quiet:T) suppresses the printing of any
descriptive comments associated with the data set in the file.

The data set name dataName need not be a legal MacAnova variable name
since the name of a data set on a file readable by matread() can include
characters such as '.' that are not legal in MacAnova variable names.
For example, 'y <- getdata(jw11.5)' is legal and will attempt to
retrieve data set "jw11.5" from DATAFILE.

Variable DATAFILE is normally pre-defined to contain "macanova.dat", the
name of a sample file with several data sets.  On some systems DATAFILE
may be pre-defined to be some standard collection of data.  After

  Cmd> DATAFILE <- "disease.dat" # or other file name

getdata() will retrieve data sets from file disease.dat.

If the value of DATAFILE is a pure file name ("disease.dat" but not,
say, "data/disease.dat"), MacAnova will first search in the current
default directory or folder and then look in the directories or folders
whose names are in CHARACTER vector DATAPATHS.  See topics 'DATAPATHS'
and 'file_names'.

If you regularly use a particular data file, say, "mydata.txt", you
might find it convenient to add the line DATAFILE <- "mydata.txt" to
your startup file.  Or, on Unix/Linux, Windows and DOS, you can include
'-d mydata.txt' in environmental variable MACANOVA.  See topics
'customize' and 'launching'.

A useful convention is to have the first dataset on the file have name
'info' and 0 lines (first header line 'info 0', with several comment
lines starting with ')' listing the datasets available in the file.
Then getdata(info) or even just getdata() will print this information.
See topic 'matread_file' for an example.


Gary Oehlert 2003-01-15