save_data | R Documentation |
This function takes either a dataframe or all of the data you've filtered, and rolls it up into a csv and/ or a shapefile for continued analysis
save_data(
db = NULL,
df = NULL,
filename = NULL,
df.crs = "EPSG:4326",
req.coords = TRUE,
lat.field = "LATITUDE",
lon.field = "LONGITUDE",
formats = c("csv", "gpkg"),
env = .GlobalEnv
)
db |
default is |
df |
This is a dataframe that you want to save in some other format. If a spatial format is selected (e.g. shapefile), it must have LATITUDE and LONGITUDE fields |
filename |
default is |
df.crs |
This is the CRS value for your dataframe. This should be the reference system that your data is known to be in.
The default value |
req.coords |
default is TRUE. This filters out records without values for LATITUDE or LONGITUDE. The function aborts if req.coords=TRUE and no records remain. |
lat.field |
the default is |
lon.field |
the default is |
formats |
This is a vector of the formats in which you would like to save the current data, including "raw" for a (local) dataframe, "sf" for a (local) simple feature object, "gpkg" for an ESRI-compatible geopackage or "csv" (both written to the wd). The raw and sp objects will just have the name specified by filename, while the csv also gets a timestamp, since it's written externally . |
env |
This the the environment you want this function to work in. The
default value is |
Note that with the retirement of rgeos, rgdal and maptools, shapefiles are no longer supported by this package. Instead, gpkg file are generated. Additionally sp objects are also being phased out and are being replaced by sf objects.
Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca
Other general_use:
cleanup()
,
get_isdb_trip_set()
,
restore_tables()
,
save_tables()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.