# getXY

0th

Percentile

##### Easy and Flexible Input for One- and Two Dimensional Data

The function accepts one- or two dimensional data, checks them for compatibility and gives a dataframe back.

Keywords
manip , error
##### Usage
getXY(x, y = NULL, unidim.allowed = TRUE)
##### Arguments
x

Vector, matrix, dataframe or list. If x is a vector, the second dimension may be defined by argument y. If x is a matrix, dataframe or list and a second column or element exists, this second element is used instead of y.

y

Optional vector of the same length as x. When argument x is onedimensional, argument y does not exist and unidim.allowed is TRUE, argument x is coerced to a vector and returned as y component where the resulting x is just the index vector 1:n.

unidim.allowed

Logical. When unidim.allowed is TRUE (=default), one and two dimensional input is accepted for any reasonable combination of x and y. In this mode getXY behaves very similar to xy.coords An error message is returned, when unidim.allowed is FALSE, argument x is onedimenional und y does not exist.

##### 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

• getXY
##### Examples
# NOT RUN {
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))
# }

Documentation reproduced from package IDPmisc, version 1.1.19, License: GPL (>= 3)

### Community examples

Looks like there are no examples yet.