I have a data.frame list. I to average every n days in each df.
I am trying to lapply over my list.
test<-lapply(dataframe_list, function(d){ 
  n <- 14
  aggregate(d,list(rep(1:(nrow(d)%/%n+1),each=n,len=nrow(d))),mean)[-1]
  d
            } 
            ) 
But I get warnings:
Warning messages: 1: In mean.default(X[[1L]], ...) : argument is not numeric or logical: returning NA 2: In mean.default(X[[2L]], ...) : argument is not numeric or logical: returning NA 3: In mean.default(X[[3L]], ...) : argument is not numeric or logical: returning NA
Here is the result of head(df) on one of the df in the list:
KGID 3MEHIS ACE_POT ADD_SUG_AVAIL_CHO ADD_SUG_TOT_SUG   ALA ALCOHOL PROTEIN_AN
1 KGID      0       0             3.135               0 1.848       0     24.181
2 KGID      0       0             3.135               0 1.848       0     24.181
3 KGID      0       0             3.135               0 1.848       0     24.181
4 KGID      0       0             3.135               0 1.848       0     24.181
5 KGID      0       0             3.135               0 1.848       0     24.181
6 KGID      0       0             3.135               0 1.848       0     24.181
Ultimately, I would like to see an average for the first 14 rows for this df, of course, the first column can't have an average. Is that my problem?
 
     
    