How to use logical operator (!) with magrittr in R
问题 I am taking a list of values and trying to find those that are not NA using magrittr. Here is a simple example: data.frame(data = c(1:2, NA, 4:5, NA, 7)) %>% is.na which yields the correct result: data [1,] FALSE [2,] FALSE [3,] TRUE [4,] FALSE [5,] FALSE [6,] TRUE [7,] FALSE When I put the not operator ! in front of is.na , I get an error: data.frame(data = c(1:2, NA, 4:5, NA, 7)) %>% !is.na gives me Error in FUN(left, right) : operations are possible only for numeric, logical or complex