Closed moriahy closed 4 years ago
This is how I was able to change the dates in the AbsoluteCover data frame:
AbsoluteCover[which(AbsoluteCover$Date == as.Date('2020-06-04')), 'Date'] = as.Date('2020-06-03') AbsoluteCover[which(AbsoluteCover$Date == as.Date('2020-06-19')), 'Date'] = as.Date('2020-06-18') AbsoluteCover[which(AbsoluteCover$Date == as.Date('2020-07-12')), 'Date'] = as.Date('2020-07-28')
I'm working in my PAR.R script: https://github.com/SpaCE-Lab-MSU/warmXtrophic/blob/master/moriah/PAR.R
I'm trying to find a way to merge the PAR and absolute cover data frames I'm working with. The only way I can think to merge the two together would be by date, but they don't have the same date, so it's not as straight forward.
Because the date isn't that important in the context of what we're trying to look at, I'm trying to change the three dates in the AbsoluteCover data frame to match the three dates in the PAR data frame aka I'm trying to change and replace the dates in the AbsoluteCover frame to something different. Here are some ways I've tried to do this:
1 :
AC <- mutate(AbsoluteCover, NewDate = c("2020-06-04" == "2020-06-03" & "2020-06-19" == "2020-06-18" & "2020-07-12" == "2020-07-28"))
This just creates a new column called "NewDate" but with all FALSE in the cells. This outcome makes sense, but it's not what I want.2 :
AC <- AbsoluteCover %>% mutate(Date, "2020-06-04" == "2020-06-03" & "2020-06-19" == "2020-06-18" & "2020-07-12" == "2020-07-28")
This does the same thing as 1 above.3 :
AC <- replace( AbsoluteCover$Date, c("2020-06-04", "2020-06-19", "2020-07-12"), c("2020-06-03", "2020-06-18", "2020-07-28") )
This just returns a data frame with one column with dates