You're right. I misread the question.
Since Cyril says all the N/As are in the second column we could use the nanair
package to replace the N?A's with NA
and then use na.omit()
library(tidyverse)
library(naniar)
dat1 <- structure(list(cat = c(1, 3, 2), dog = c("2", "N/A", "N/A"),
rabbit = c(9, 9, 5)), row.names = c(NA, -3L), spec = structure(list(
cols = list(cat = structure(list(), class = c("collector_double",
"collector")), dog = structure(list(), class = c("collector_character",
"collector")), rabbit = structure(list(), class = c("collector_double",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), delim = ","), class = "col_spec"), problems = <pointer: 0x5645710ddd10>, class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"))
dat2 <- dat1 %>% replace_with_na(replace = list(dog = "N/A"))