A helper function to convert data.frames
or objects inheriting from
data.frame
, e.g. tibble::tibble()
or data.table::data.table()
into
a list suitable for use in extractOz functions.
Arguments
- x
data.frame
. A three column object with the first column being the location name, the second longitude, named "x", and the third, latitude, named "y", as decimal degrees innumeric
format.- names
Integer
. The column in which the location names are located. Defaults to 1.- lonlat
Vector
. A set ofinteger
values indicating the column index in which the longitude and latitude values are contained. Defaults to2:3
.
Author
Adam H. Sparks, adamhsparks@gmail.com
Examples
library(readr)
read_csv(system.file(
"extdata",
"sample_points.csv",
package = "extractOz",
mustWork = TRUE
)) |>
df_to_list(names = 1, lonlat = 2:3)
#> Rows: 3 Columns: 3
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): site
#> dbl (2): x, y
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> $Merredin
#> x y
#> 118.28 -31.48
#>
#> $Corrigin
#> x y
#> 117.87 -32.33
#>
#> $Tamworth
#> x y
#> 150.84 -31.07
#>