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