This is used as a checking mechanism for other functions to ensure data is given in the appropriate format, and if it is not, converting to the appropriate format where possible.

1 2 | ```
ensure3d(x)
ensurelonlat(x)
``` |

`x` |
A vector, matrix or dataframe to be checked |

*ensure3d* checks to ensure that the given data are one or more sets of 3D Cartesian coordinates, and converts them to numeric vectors if they are not already. If latitudes and longitudes are given as input into *ensure3d*, they will be converted to 3D Cartesian coordinates, on the unit sphere.
*ensurelonlat* checks to ensure that the given data are one or more pairs of longitude and latitude and converts the data to a pair of lists if they are not already. Vectors and single rows/columns of matrices can be used as input for both functions; multiple rows/colums of matrices and pairs of lists can also be used as input for *ensurelonlat*.

*ensure3d*
A numeric vector or matrix
*ensurelonlat*

`$lon` |
List of Longitudes |

Adrian Baddeley and Tom Lawrence

1 2 | ```
ensure3d(c(1,4,2))
ensurelonlat(c(-90,145))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.