sunRiseSet: Obtain sunrise and sunset times

Description Usage Arguments Value Author(s) Examples

View source: R/sunRiseSet.R

Description

Creates and adds a sunrise and sunset column to a data.frame containing latitude, longitude, and a date/time as POSIXct or numeric.

Usage

1
sunRiseSet(data, lat = "recvDeployLat", lon = "recvDeployLon", ts = "ts")

Arguments

data

a selected table from .motus detection data, eg. "alltags", or a data.frame of detection data including at a minimum variables for date/time, latitude, and longitude

lat

variable with latitude values, defaults to recvDeployLat

lon

variable with longitude values, defaults to recvDeployLon

ts

variable with time in UTC as numeric or POSIXct, defaults to ts

Value

the original dataframe provided, with the following additional columns: - sunrise: sunrise time for the date and location provided by ts and lat/lon per row - sunset: sunset time for the date and location provided by ts and lat/lon per row

Author(s)

Zoe Crysler zcrysler@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
You can use either a selected tbl from .motus eg. "alltags", or a data.frame, instructions to convert a .motus file to all formats are below.
sql.motus <- tagme(176, new = TRUE, update = TRUE) # download and access data from project 176 in sql format
tbl.alltags <- tbl(sql.motus, "alltags") # convert sql file "sql.motus" to a tbl called "tbl.alltags"
df.alltags <- tbl.alltags %>% collect %>% as.data.frame() ## convert the tbl "tbl.alltags" to a data.frame called "df.alltags"

Add sunrise and sunset columns to a data.frame from alltags
sun <- sunRiseSet(df.alltags)

get sunrise and sunset information from tbl.alltags using gps lat/lon
sun <- sunRiseSet(tbl.alltags, lat = "gpsLat", lon = "gpsLon")

jbrzusto/motus documentation built on May 18, 2019, 7:03 p.m.