Description Usage Arguments Value Author(s) Examples
View source: R/timeToSunriset.R
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
1 2 | timeToSunriset(data, lat = "recvDeployLat", lon = "recvDeployLon",
ts = "ts", units = "hours")
|
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" |
the original dataframe provided, with the following additional columns:
sunrise: sunrise time for the date and location provided by ts and recvDeployLat/recvDeployLon per row
sunset: sunset time for the date and location provided by ts and recvDeployLat/recvDeployLon per row
ts_to_set: time to next sunset after "ts", units default to "hours"
ts_since_set: time to previous sunset since "ts", units default to "hours"
ts_to_rise: time to next sunrise after "ts", units default to "hours"
ts_since_rise: time to previous sunrise since "ts", units default to "hours"
Zoe Crysler zcrysler@gmail.com
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.