getXY {IDPmisc} | R Documentation |
Easy and Flexible Input for One- and Two Dimensional Data
Description
The function accepts one- or two dimensional data, checks them for compatibility and gives a dataframe back.
Usage
getXY(x, y = NULL, unidim.allowed = TRUE)
Arguments
x |
Vector, matrix, dataframe or list. If |
y |
Optional vector of the same length as |
unidim.allowed |
Logical.
|
Details
Input is checked for compatibility: When x
is a list, the
first two elements must have identical length. When y
is
defined, x
must be one dimensional and must have the same
length as argument y
. When onedim.allowed
is
FALSE, input must be twodimensional.
When input is one dimensional and unidim
is TRUE, y
gives the numbers of elements back.
Function works similar to xy.coords
Value
dataframe with the components x
and y
Author(s)
Rene Locher
Examples
getXY(3:4, 1:2)
getXY(matrix(1:4,ncol=2))
getXY(as.data.frame(matrix(1:4,ncol=2)))
getXY(4:1)
getXY(list(a=1:2,b=9:10))