For such aggregation calculation, you want to use group_by command to group, in this case, that is day, then summarize command to aggregate, in this case, that is ‘sum’.
summarize(profit = sum(profit))
If the day column is not Date, instead it’s POSIXct (date and time), then you…
You can use today() (for Date type) or now() (for POSIXct) function to return the current date/time. Then, you can have a mutate command to be like this.
mutate(age = today() - birth_date))
This will return a ‘age’ column as diff data type, which has the numbers as ‘Days’, if the underlying data type…
You can use filter_if or filter_at.
Here are the examples.
filter_if(is.Date, all_vars(between(., as.Date("2016-09-03"), as.Date("2016-09-20"))))
This will evaluate the column data types and execute the filter condition inside all_vars() function for the matched columns, in…