Skip to content
Prev 392271 / 398502 Next

Using R lines() to show sunrise and sunset

Make a dummy variable using an if test. Ifelse(as.numeric(hour(time))<11,df$rise=0,df$rise=1)
Then you could use filter() to split the dataset into two parts, or you could use pivot_wider().
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Gregory Coats via R-help
Sent: Monday, July 18, 2022 8:18 PM
To: David Winsemius <dwinsemius at comcast.net>
Cc: Gregory Coats via R-help <r-help at r-project.org>
Subject: Re: [R] Using R lines() to show sunrise and sunset

[External Email]

Thanks. Yes, I can follow
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.stat.berkeley.edu_-7Es133_dates.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cc9Eq3DGpCl6kcfJbKVLDsJ9i6TKk7SF79PHaRy8-GoQctAlVTXhQIVEHHwO08Q8&s=ym6pjfQa0pw3I4kXT4_gM3iUDXXy52lWTJkwCbXi2NM&e=
Dates and Times in R
But my problem is, How to direct R to accept the first computed value as a sunrise, and the second computed values as a sunset?
Greg Coats
571-423-9847
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cc9Eq3DGpCl6kcfJbKVLDsJ9i6TKk7SF79PHaRy8-GoQctAlVTXhQIVEHHwO08Q8&s=7qZYIyeP1-uuz3co5hy-m-ZI7YGOslQI_-_I89eoJ5I&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cc9Eq3DGpCl6kcfJbKVLDsJ9i6TKk7SF79PHaRy8-GoQctAlVTXhQIVEHHwO08Q8&s=EZBJpqiZa4ZdtRdgor6WYiCsrheRBMsp1O31mCpoHPU&e=
and provide commented, minimal, self-contained, reproducible code.