I want to check whether values in a column are bigger than the specific value or not. And if there are bigger values, I should draw a line by using these data according to cars' names.
Here is sample data and code:
df <- mtcars[1:5]
df %>%
filter(if (mpg>20.0) mpg=mpg else filter(mgp==0))
I cannot check every value of mpg compares to 20.0. I searched and tried to understand some problems like that, yet I could not apply these solutions. I also tried to apply the "when_case" function, but I failed again.
Aucun commentaire:
Enregistrer un commentaire