Description Usage Arguments Details Value Author(s) See Also Examples

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, single = FALSE)
ensurelonlat(x)
``` |

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

`single` |
Logical indicating whether a single point is expected. |

*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 longitudes and latitudes 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 |

`$lat` |
List of Latitudes |

Adrian Baddeley, Ege Rubak and Tom Lawrence

1 2 3 4 5 |

```
[1] 1 4 2
[1] 1 2 3
x y z
[1,] 1 3 5
[2,] 2 4 6
[,1] [,2] [,3]
[1,] 0.7071068 0.000000e+00 -0.7071068
[2,] -0.7071068 8.659561e-17 0.7071068
$lon
[1] 145
$lat
[1] -90
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.