Skip to content
Prev 392272 / 398503 Next

Using R lines() to show sunrise and sunset

a) Wouldn't distinguishing between sunrise and sunset just amount to referring to the relevant column in your data frame? Why is this a problem you need help with?

b) There is no problem with plotting datetimes in R. But you might want to consider plotting hour-of-day instead on the y axis to avoid the monotonocally increasing appearance you would end up with. R does not have a concept of time-of-day separate from date, due to different days having different numbers of hours in them. To compute hour-of-day subtract the beginning of day (use trunc.POSIXt, units = "days") from the actual time and convert the resulting difftime to numeric. 

3) General challenges with formulating a response: I can't tell what to do with your command lines, and your use of formatted email is mushing stuff together. You have been vague about what inputs you have (have you imported the data?) or what kind of plot you expect to get using the lines function. (Also I avoid base R plotting functions most of the time, so I tend to sit out on threads that are looking for help with it.)
On July 18, 2022 5:17:51 PM PDT, Gregory Coats via R-help <r-help at r-project.org> wrote: