library(lubridate) library(ggplot2) library(StreamMetabolism) library(xts) library(reshape) library(scales) Bern <- sunrise.set(46.947999,7.448148, "2024/01/01", timezone="MET", num.days=370) sunrise <- Bern$sunrise sunset <- Bern$sunset sunrise <- strftime(sunrise, format="%R", tz="MET") sunset <- strftime(sunset, format="%R", tz="MET") Bern["sr"] <- as.POSIXct(sunrise, format = "%H:%M") Bern["ss"] <- as.POSIXct(sunset, format = "%H:%M") Bern["timestamp"] <- align.time(Bern$sunrise, 60*10) Bern <- Bern[c("timestamp", "sr", "ss")] locsrss <- ggplot(Bern, aes(x=Bern$timestamp)) + geom_line(aes(y=Bern$sr)) + geom_line(aes(y=Bern$ss)) + labs(title = " Sonnenauf-/Sonnenuntergang - Bern 2024", x = "Datum", y = "Zeit") pdf("Bern_SA_SU.pdf", paper="a4r", width=11) locsrss dev.off() png(filename="Bern_SA_SU.png", width = 1400, height = 800, units = "px") locsrss dev.off() Bern["Sonnenaufgang"] <- strftime(Bern$sr, format="%H:%M") Bern["Sonnenuntergang"] <- strftime(Bern$ss, format="%H:%M") write.table(Bern, file="Bern_SaSu.csv", dec=',', sep=';', row.names=FALSE)