make_sf: #' Function providing a shorthand for converting a data frame...

Description Usage Arguments Value Examples

View source: R/make_sf.R

Description

#' Function providing a shorthand for converting a data frame with an X and Y column to a simple feature with a specified coordinate reference system. This will default to latitude and longitude if the X and Y columns are not specified, selecting the columns with "lon" and "lat" in any case for the x_colname and y_colname respectively, and setting the CRS to 4326. If multiple columns contain these strings, the column names but be specified.

Usage

1
make_sf(data, x_colname = NULL, y_colname = NULL, crs = 4326)

Arguments

data

a dataframe or tibble containing a geojson column

x_colname

a string containing the column name of the x coordinate column

y_colname

a string containing the column name of the y coordinate column

crs

a string or numeric vector representing the coordinate reference system code

Value

A simple feature data frame or tibble.

Examples

1
2
make_sf(data=data.frame("Longitude"=c(1,2,3),"Latitude"=c(51,52,53)),x_colname="Longitude",y_colname="Latitude",crs=4326)
make_sf(data=data.frame("Longitude"=c(1,2,3),"Latitude"=c(51,52,53)))

SamA-DS/Rbduk documentation built on May 1, 2021, 5:29 a.m.