Hello, I've been trying to understand my problem with filter and why it gives different outcomes. I tried to find the answer but without a luck, hopefully it's not a total novice mistake.
The dataset is here: FitBit Fitness Tracker Data | Kaggle
I work on file: dailyActivity_merged.csv
library(dplyr)
dailyActivity_mergedTEST %>%
filter(TotalSteps >= 50 & SedentaryMinutes >= 400) %>%
View()
This code doesn't consider both conditions and just filters out total steps that are equal or less than 50 AND separately filters our Sedentary minutes that are equal or less than 400.
It returns 844 rows.
library(dplyr)
dailyActivity_merged %>%
filter(!(TotalSteps <= 50 & SedentaryMinutes <= 400)) %>%
View()
This code considers both options.
It returns 936 rows.
I've checked manually and I know that the one with 936 rows works as intended. I work on rstudio cloud. Both columns are numeric.
Question is, why this way? What am I missing in my understanding here?
Edit: highlighted code