Next: sethistory() Up: MacAnova Help File Previous: secoefs()   Contents

select()

Usage:
select(k, x), k vector of positive integers or LOGICAL vector, x a
  matrix.



Keywords: combining variables, variables
select(k, x) computes vector(x[1,k[1]],x[2,k[2]],...,x[n,k[n]]), where n
= nrows(k).  For example, select(k,x)[i] is x[i,k[i]], the k[i]-th
element of the i-th row of x. The length of the result is nrows(k).

k must be a REAL vector of positive integers or a LOGICAL vector and x
must be a matrix with nrows(x) >= nrows(k) and ncols(x) >= max(k),

When k is a LOGICAL vector, False is translated to 1, and True is
translated to 2.  For example, when x is a matrix with two columns,
select() can be used to select column 1 or column 2 of x depending on
whether k[i] is False or True.  NOTE: This differs from home LOGICAL
subscripts are interpreted.  See 'subscripts'

If k[i] is MISSING, select(k,x)[i] is MISSING when x is LOGICAL or REAL
and is "" when x is a CHARACTER variable.

When x is REAL or LOGICAL and k has no MISSING values, select(k, x) is
equivalent to vector(x[hconcat(run(nrows(k)), k)]).

See topic 'subscripts'.


Gary Oehlert 2003-01-15