[R] How to average minutes per hour per month in the form of '# hours #minutes'

Dr Eberhard W Lisse no@p@m @end|ng |rom ||@@e@NA
Sun Mar 21 15:31:10 CET 2021


Hi,

I have minutes worked by day (with some more information)

which when using

	library(tidyverse)
	library(lubridate)

run through

	CONSMINUTES %>%
		select(datum, dauer) %>%
		arrange(desc(datum))

look somewhat like

	# A tibble: 142 x 2
	   datum      dauer
	   <date>     <int>
	 1 2021-03-18    30
	 2 2021-03-17    30
	 3 2021-03-16    30
	 4 2021-03-16    30
	 5 2021-03-16    30
	 6 2021-03-16    30
	 7 2021-03-11    30
	 8 2021-03-11    30
	 9 2021-03-11    30
	10 2021-03-11    30
	# … with 132 more rows

I can extract minutes per hour

	CONSMINUTES %>%
	select(datum, dauer) %>%
	group_by(week = format(datum, '%Y %V'))%>%
	summarise_if(is.numeric, sum)

and minutes per month

	CONSMINUTES %>%
	select(datum, dauer) %>%
	group_by(month = format(datum, '%Y %m'))%>%
	summarise_if(is.numeric, sum)

I need to show the time worked per week per month in the format of

	'# hours # minutes'

and would like to also be able to show the average time per week per
month.

How can I do that (preferably with tidyverse :-)-O)?

greetings, el



More information about the R-help mailing list