I am quite new using R and Function so please take this in account in your answer.
I have the data bellow and when I try to get the mean for both columns using the period.apply with FUNCTION + na.rm = TRUE since I have NA in the real data I get only the aggregate mean and not the column mean as in the example bellow. The question is how can I get the per column mean and using na.rm = TRUE Thanks
zoo.data_1 <- zoo(rnorm(31)+10,as.Date(13514:13744,origin="1970-01-01"))
zoo.data_2 <- zoo(rnorm(20)+10,as.Date(13514:13744,origin="1970-01-01"))
zoo.data <- merge(zoo.data_1,zoo.data_2)
ep <- endpoints(zoo.data,'month')
period.apply(zoo.data, INDEX=ep, FUN=function(x) mean(x,na.rm = TRUE))
period.apply(zoo.data, INDEX=ep, FUN=mean)
So what I need is format (per column) bellow but with na.rm = TRUE