I want to select columns with numeric values >= 0.
cities <- c("Nantes", "Paris", "London", "Munchen")
variable1 <- c(-100, 20, 5, 30)
variable2 <- c(10, 13, 2, 30)
variable3 <- c(10, 200, -5, 300)
df <- data.frame(cities, variable1, variable2, variable3)
What I tried without success :
library(tidyverse)
df %>% select_if(is.numeric >=0)
What I want :
cities variable2
1 Nantes 10
2 Paris 13
3 London 2
4 Munchen 30