Learn R Programming

activity (version 1.3)

solartime: 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, long, tz, format = "%Y-%m-%d %H:%M:%S")

Arguments

dat

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

lat, long

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).

format

A character string defining the time-date format if dat is character format, see strptime for details. Ignored if x is not character.

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.

Details

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

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

Run this code
# NOT RUN {
data(BCItime)
subdat <- subset(BCItime, species=="ocelot")
times <- solartime(subdat$date, 9.156335, -79.847682, -5, "%d/%m/%Y %H:%M")
rawAct <- fitact(times$clock)
avgAct <- fitact(times$solar)
plot(rawAct)
plot(avgAct, add=TRUE, data="n", tline=list(col="cyan"))
# }

Run the code above in your browser using DataLab