I am use R mutate to update a specific (conditional) row with a calculated function, namely, nrow(), to update with an add (+) value. I cannot use apply() as I need to update only one (1) row for a specific value.
For example, when find row Year==2007 and Month==06, add Incoming.Exam + nrow(df3), so that row will be 698+nrow value.
I get the following error from mutate impl:
Error in mutate_impl(.data, dots) : Column
abberville_LAmust be length 96 (the number of rows) or one, not 4
abberville_LA %>%
mutate(abberville_LA, Incoming.Exam = ifelse(abberville_LA$Year == 2007 & abberville_LA$Month == 06, abberville_LA, Incoming.Exam + nrow(abberville_df3), abberville_LA$Incoming.Exam))
head(abberville_LA, 3)
Incoming.Exam Year Month ts_date
1 698 2007 6 2007-06-01
2 NaN 2010 6 2010-06-01
$inmutate. - NelsonGonabberville_LAmust be length 96 (the number of rows) or one, not 4 - user1857373abberville_LA %>% ...you don't need to addabberville_LAagain inmutateas first argument. - Ronak Shah