Created
June 2, 2014 01:19
-
-
Save hilaryparker/2a83ca521353e8478c92 to your computer and use it in GitHub Desktop.
sunrise.set.R function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sunrise.set <- function (lat, long, date, timezone = "UTC", num.days = 1) | |
{ | |
lat.long <- matrix(c(long, lat), nrow = 1) | |
day <- as.POSIXct(date, tz = timezone) | |
sequence <- seq(from = day, length.out = num.days, by = "days") | |
sunrise <- sunriset(lat.long, sequence, direction = "sunrise", | |
POSIXct = TRUE) | |
sunset <- sunriset(lat.long, sequence, direction = "sunset", | |
POSIXct = TRUE) | |
ss <- data.frame(sunrise, sunset) | |
ss <- ss[, -c(1, 3)] | |
colnames(ss) <- c("sunrise", "sunset") | |
return(ss) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have data in hourly data, how to separate my hourly data in "Day" and "Night".