solartime {activity}R Documentation

Transforms clock time to solar time anchored to sun rise and sunset times for a given location.

Description

This is a wrapper for transtime that takes non-numeric date-time input together with latitude and longitude to calculate mean average sunrise and sunset times, which are then used to anchor the transformation using average anchoring.

Usage

solartime(
  dat,
  lat,
  lon,
  tz,
  ...,
  tryFormats = c("%Y-%m-%d %H:%M:%OS", "%Y/%m/%d %H:%M:%OS",
    "%Y:%m:%d %H:%M:%OS", "%Y-%m-%d %H:%M", "%Y/%m/%d %H:%M",
    "%Y:%m:%d %H:%M", "%Y-%m-%d", "%Y/%m/%d", "%Y:%m:%d")
)

Arguments

dat

A vector of character, POSIXct or POSIXlt date-time values.

lat, lon

Single numeric values or numeric vectors the same length as dat giving site latitude and longitude in decimal format.

tz

A single numeric value or numeric vector same length as dat giving time zone (see Details).

...

arguments passed to as.POSIXlt

tryFormats

formats to try when converting date from character, passed to as.POSIXlt

Details

Time zone tz should be expressed in numeric hours relative to UTC (GMT).

Value

A list with elements:

input: event input dates-times in POSIXlt format.

clock: radian clock time data.

solar: radian solar time data anchored to average sun rise and sun set times.

References

Vazquez, C., Rowcliffe, J.M., Spoelstra, K. and Jansen, P.A. in press. Comparing diel activity patterns of wildlife across latitudes and seasons: time transformation using day length. Methods in Ecology and Evolution.

See Also

strptime, transtime

Examples

data(BCItime)
subdat <- subset(BCItime, species=="ocelot")
times <- solartime(subdat$date, 9.156335, -79.847682, -5)
rawAct <- fitact(times$clock)
avgAct <- fitact(times$solar)
plot(rawAct)
plot(avgAct, add=TRUE, data="n", tline=list(col="cyan"))

[Package activity version 1.3.4 Index]