loadData: Import spatial datasets

Description Usage Arguments Details Value See Also Examples

View source: R/loadData.R

Description

Meta function to import, i.e. load or download and unpack spatial datasets and other files containing spatial data.

Usage

1
2
loadData(files = NULL, layer = NULL, dataset = NULL,
  localPath = NULL, verbose = FALSE, ...)

Arguments

files

[character(.) | data.frame(1)]
the files, as they are called in localPath. files also accepts the (subsetted) output of catalog, i.e. a data.frame with the two columns original and abbr.

layer

[character(.) | integerish(.)]
vetor of the same length as files with name or position of the layer that shall be loaded.

dataset

[character(1)]
character vector of the dataset for which files should be imported (see obtain for all datasets); in case this is given, localPath is taken from the internal default for the respective dataset (see setPaths).

localPath

[character(1)]
the local path from where files shall be loaded. If the directory does not exist, it is created and the missing data are downloaded, given .

verbose

[logical(1)]
should additional information be printed (TRUE) or should it be suppressed (FALSE, default)?

...

[various]
other arguments of the load operators.

Details

importData checks whether the required files are available in localPath and if this is not given, in the working directory. If nothing is found there but a dataset is given, it attempts to download the files from the respective online path (see rtPaths). Please take a look at it and in case an online resource has been altered, you can adapt it here (see setPaths).

Value

the file to load. If there is more than one file specified, a list of those files.

See Also

The specific load operators: load_kml, load_csv, load_hdf, load_tif, load_dbf, load_shp, load_svg

Examples

1
2
3
4
5
6
require(magrittr)

myLocations <- loadData(files = "locations.csv",
                   localPath = system.file("test_datasets", package="rasterTools")) %>%
  geomRectangle() %>%
  setCRS(crs = projs$laea)

EhrmannS/rasterTools documentation built on Feb. 4, 2019, 11:22 a.m.