Re: [R] adding a date column with dplyr

2016-08-06 Thread Alice Domalik
Thanks so much, that worked! - Original Message - From: "Don MacQueen" To: "Alice Domalik" <9a...@queensu.ca>, r-help@r-project.org Sent: Friday, August 5, 2016 2:18:16 PM Subject: Re: [R] adding a date column with dplyr What's wrong with this?

Re: [R] adding a date column with dplyr

2016-08-05 Thread MacQueen, Don
What's wrong with this? df$Night <- as.POSIXct( paste(format(df$Date,'%Y-%m-%d'),'21:30')) or df$Night <- trunc(df$Date,'day') + 21*60*60 + 30*60 I believe both of those satisfy "the day of tracking for each animal, but with the time of 21:30". But perhaps you meant the day that tracking starte