Im having trouble creating a table that count all the activities recorded at a specific time (30 min intervals).. please help
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
tud <- monday
#> Error in eval(expr, envir, enclos): object 'monday' not found
# create a table of time and activity count for every 30min intervals
table <- monday %>%
group_by(Time) %>%
mutate(count = summarize(count = n()))
#> Error in eval(lhs, parent, parent): object 'monday' not found
Here is code that filters out the two categories Sleeping and Napping before grouping and counting. Notice the ! before Activity in the the filter(). That inverts the logical result so the filter looks for Activity that is not in the given list.
Your timestamps are probably coming as characters. The lubridate package has convenient functions for converting characters to dates or timestamps. What format do your timestamps have in the original data?