I have the following data frame of letters with some blank (NA) slots for the lower cases
letters_df <- data.frame(caps = LETTERS[1:10], lows = letters[c(1,2,11,11,11,11,11,11,11,10)])
letters_df[letters_df == "k"] <- NA
letters_df
To fill in some of the blanks I am using this new data frame I constructed
new_letters <- data.frame(caps = c("C", "D", "F", "G", "H"),
lows = c("c", "d", "f", "g", "h"))
Following on from a previous question I am using dplyr mutate and case_when as follows
letters_df %>%
mutate(lows = case_when(
caps %in% new_letters$caps ~ new_letters$lows,
TRUE ~ lows))
However, the result does not add in the missing letters and throws an error asking for a vector of the same length as the letters_df column. I thought I had a good handle on the syntax here. Can help me with where I am going wrong?