when I want to identify complete cases across several columns using dplyr it will not work if columns are of different types. How to code to solve this error?
My code looks like this:
Yeah, thought about drop_na() but could not come up with an idea how to use it on a subset of columns, that is, eliminate NAs based only on a subset of variables, while retaining all columns and all rows in the dataframe..
PS. I somehow cannot rely this to my data frame, the error message is "compcases must be size 1 not ..." but I guess it is something with my data frame, it works fine with starwars
however, this notation works:
res <- starwars
res$compcases <- select(starwars,name:mass,birth_year) |> complete.cases()