sp_extract_pt: Extract environmental data - pt based

Description Usage Arguments Details Examples

View source: R/sp_extract_pt.R

Description

Extract environmental data - pt based

Usage

1
sp_extract_pt(x, from = "noaa_isd", radius = 50, select = "first", date = NULL)

Arguments

x

input data.frame

from

which data source, only 'noaa_isd' for now OR an object with data in it, including data.frame or SpatialPointsDataFrame

radius

radius, in km, for which to search for stations/point locations from each input point in x

select

Ignored right now

date

Date to search for data for. Ignored if you supply your own env data in from

Details

Works for the use case of finding locations for point based stations, e.g., floats/buoys type data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
file <- system.file("examples", "obis_mola_mola.csv", package = "spenv")
dat <- read.csv(file, stringsAsFactors = FALSE)
head(dat)

# data.frame input
res <- sp_extract_pt(x = dat[1:10,], radius = 10)
dplyr::bind_rows(res)

# spatial objects
## SpatialPointsDataFrame - w/ NOAA remote data
library("sp")
coordinates(dat) <- ~longitude + latitude
sp_extract_pt(dat, radius = 10)

## SpatialPointsDataFrame - w/ data.frame
file <- system.file("examples", "noaa_data.csv", package = "spenv")
ref <- read.csv(file, stringsAsFactors = FALSE)
sp_extract_pt(x = dat, from = ref, radius = 10)

## End(Not run)

ropenscilabs/spenv documentation built on Sept. 22, 2020, 4:46 p.m.