search for: rep_tab

Displaying 2 results from an estimated 2 matches for "rep_tab".

2018 May 09
0
Seasonal weekly average
...with a column of dates rep_df<-data.frame(rep_dates=as.Date(rep_dates,format=date_format)) # add the week of the year rep_df$rep_week<-format(rep_df$rep_dates,"%V") # add the year rep_df$rep_year<-format(rep_df$rep_dates,"%Y") # get a table of the weekly counts by year rep_tab<-table(rep_df$rep_week,rep_df$rep_year) # get the row means (5 year averages) rep5<-apply(rep_tab,1,mean) # plot the 5 year weekly averages plot(rep5,type="b",ylim=c(0,4),xlab="Week",ylab="Reports per week") # add the 2017 weekly counts points(rep_tab[,5],type=&q...
2018 May 09
3
Seasonal weekly average
Hi, I am fairly new to 'R' and would like advice on the following. I want to calculate a weekly average number of reports (e.g. of flu, norovirus) based on the same weeks for the last five years. I will then use this to plot a chart with 52 points for the average based on the last five years; another line will then plot the current year, enabling a comparison of current weekly counts