##This is a function that I am trying to write to calculate sunrise and sunset and works "mostly", but returns nonsensical values. What am I #missing? Thanks in advance.
###remember to include maptools as dependence### library(maptools) sunrise.set <- function(lat, long, date, timezone="UTC", num.days=1){ #this needs to be long lat# 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) } #This doesn't make any sense sunrise.set(33.46, 84.25, "2008-11-08", timezone="EST") -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.