Description Usage Arguments Examples
This function exports spatial and attribute data to file. The output file type can be a shapefile (.shp), comma separated value file (.csv), Excel workbook (.xlsx), or a SAS data file (.sas7bdat).
1 | geo_export(x, path, filetype, na = NA, overwrite = FALSE)
|
x |
Name of R data object to output. REQUIRED. |
path |
Filepath specifying location and name of output file to create. REQUIRED. |
filetype |
Type of output file to create. Must be one of the following: "shp" (default), "csv" (.csv comma separated value file), "sas" (.sas7bdat data file), "excel" (.xlsx workbook file). REQUIRED. |
na |
Character string to be used for missing values in the output file. Replaces all empty values ("" and " "), and properly coded missing values (NA), with the specified string. If no string is provided, default is NA. OPTIONAL. |
overwrite |
If output dataset already exists at the path location, should R overwrite (replace existing file) or not? Default is to not overwrite an existing file. OPTIONAL. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # simple export shp file ------------------------------------------------------------------
geo_export(x = my_dat,
path = my_outdir,
filetype = "shp",
overwrite = TRUE)
# exporting when file already exists ------------------------------------------------------
geo_export(x = my_dat,
path = my_outdir,
filetype = "shp",
overwrite = FALSE) # will not replace existing file
geo_export(x = my_dat,
path = my_outdir,
filetype = "shp",
overwrite = TRUE) # replaces existing file
# specify new value ('unknown') to replace empty and missing values in output file --------
geo_export(x = my_dat,
path = my_outdir,
filetype = "shp",
na = "unknown",
overwrite = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.