Hello. I am new to R. I am having a go with a small project pulled from the Data Analytics course I did to build R proficiency. It is to use smart device data to gain insight on how they're using smart devices. I was given a lot of datasets to work with. I used the dailyActivity_merged.csv to start.
As I was looking at the data, I saw that the data did not look complete. They were some inconsistencies for example, the total time in minutes was not 24 hours for some and total steps on some values were 0 which is weird. So I filtered that to create a new table with IDs and days where there was a full 24 hour data collection. Now, with this new table, I was trying to find the mean of various minutes spent very active, light active, fairly active and sedentary per ID with anomalies filtered. This is the code I used:
ID_A <- true_full_day %>%
filter(Id == 1503960366) %>%
filter(VeryActiveMinutes) %>%
mean(VeryActiveMinutes)
This is the error message I got:
Error in filter()
:
! Problem while computing ..1 = VeryActiveMinutes
.
Input ..1
must be a logical vector, not a integer.
Run rlang::last_error()
to see where the error occurred.
ID_A <- true_full_day %>%
- filter(Id == 1503960366) %>%
- filter(VeryActiveMinutes) %>%
- mean(VeryActiveMinutes)
This what stood out
My question remains can the mean only be coded as long as the data type is a vector or what?