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