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