Next: clipwritedat() Up: MacAnova Help File Previous: CLIPBOARD   Contents

clipreaddata

Usage:
clipreaddata(name1,...,namek [,factors:T] [,keyword phrases]),
  name1,... names, quoted or unquoted variable names
clipreaddata(vector("name1",...,"namek") [,factors:F][,keyword phrases])
clipreaddata([factors:F] [,keyword phrases])



Keywords: input
Macro clipreaddata() creates data vectors from information on the
clipboard.  It uses macro readdata() to "read" the clipboard and its
usage is identical, except that you don't specify a file name.  Like
readdata(), it can handle data sets in which some data columns are
non-numerical and can get variable names from the first line of the
clipboard.

Any line on the clipboard that starts with skip character '#' is
automatically skipped and is echoed to output by default.

clipreaddata() is particularly useful for importing data from a spread
sheet program, particularly if the first line contains variable names.
In the spread sheet program, you select a rectangular set of cells
containing numbers and copy them to the Clipboard by selecting Copy on
the Edit menu.  After switching to MacAnova, you then use clipreaddata()
to create MacAnova variables from the data in each column you selected.
For instance, if the selection contains 10 rows and 5 columns of data,
clipreaddata() will make 5 length 10 vectors.  Caution: Before copying
to the clipboard, fill any empty cells with one of "?", "*", "." or
"NA".  clipreaddata() will read these as MISSING values.

clipreaddata(name1,name2,...,namek) uses vecread() to read one or more
columns of data from variable CLIPBOARD, creating variables.  name1,
name2, ..., namek.  The variable names can be either quoted ("weight")
or unquoted (weight).

Text on the clipboard should consist of k columns of "words" separated
by spaces, commas or tabs.  A column consisting entirely of numbers,
possibly with MISSING values (indicated by '?', '.', '*' or 'NA') is
read as a REAL vector.  A word is any set of consecutive characters not
including a comma, space or tab.

When the first data item in a column is not a number or a code for
MISSING, the entire column is normally read as a factor, with a level
for each distinct word in the column.  The factor has the original words
in the file as row labels.

clipreaddata(name1,...,factors:F) does the same except a variable
starting with a non-numerical word is read as a CHARACTER vector rather
than translated into a factor.

clipreaddata([,factors:T]) does the same except the names for the
variables are assumed to be in the first non-skipped line of the
clipboard with the data starting in the second non-skipped line.

For all usages, the number of variable names, whether given as arguments
or taken from the first line of the clipboard, must divide the total
number of data values.  And of course the names must be legal MacAnova
variable names.

By default, for each variable, clipreaddata() prints a line containing
the variable name and information on its type, REAL, factor or
CHARACTER.  You can suppress this by including 'quiet:T' as an argument.

You can use most vecread() keywords 'quiet', 'silent', 'stop', 'skip',
'skipthru', 'go', 'quiet', 'echo', and 'n', but not 'bypass', 'bywords',
'bylines', 'bychars', 'byfields' and 'realorchar'.  See topic
'vecread_keys'.

See also fromclip(), toclip(), readcols(), vecread(), 'vecread_files'.


Gary Oehlert 2003-01-15