timeToSunriset: Obtain time to and from sunrise/sunset for a dataframe...

Description Usage Arguments Value Author(s) Examples

View source: R/timeToSunriset.R

Description

Creates and adds columns for time to, and time from sunrise/sunset based on a column of POSIXct dates/times dataframe must contain latitude, longitude, and a date/time variable

Usage

1
2
timeToSunriset(data, lat = "recvDeployLat", lon = "recvDeployLon",
  ts = "ts", units = "hours")

Arguments

data

a selected table from .motus 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

units

units to display time difference, defaults to "hours", options include "secs", "mins", "hours", "days", "weeks"

Value

the original dataframe provided, with the following additional columns:

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"

get sunrise and sunset information with units in minutes using tbl file tbl.alltags
sunrise <- timeToSunriset(tbl.alltags, units = "mins")

get sunrise and sunset information with units in hours using gps lat/lon using data.frame df.alltags
sunrise <- timeToSunriset(df.alltags, lat = "gpsLat", lon = "gpsLon")

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