I am new (very new) to R coding and can't seem to figure out how to get the quartiles output correct. Might be much simpler than I am finding it to be!
PLEASE HELP!
This is the code I currently have and it is working perfectly for median and mean.
MedianCol = aggregate.data.frame(
x = list(COLVALUE=COLVALUE),
by = list(YEAR=YEAR),
FUN = median,
na.rm=TRUE
)
MeanCol = aggregate.data.frame(
x = list(COLVALUE=COLVALUE),
by = list(YEAR=YEAR),
FUN = mean,
na.rm=TRUE
)
#This is where I have an issue, I don't know how to even code it
Q3Col = aggregate.data.frame(
x = list(COLVALUE=COLVALUE),
by = list(YEAR=YEAR),
FUN = quantile(0.25),
na.rm=TRUE
)
#I will have to add the quartiles in the merge below as well
MovingAverage <- merge(x = MedianCol, y = MeanCol, by = "YEAR", all = TRUE)
The Q3Col is where I need the Third Quartile value to be returned. I also need the first Quartile, Best Decile and Worst Decile.
My Data looks like this: Data
Thank you in advance!
meanColandmedianColwork for you?are u trying to write a function?quantile(0.25)is not a function, tryQ3Col = aggregate.data.frame(x = list(COLVALUE=COLVALUE), by = list(YEAR=YEAR), FUN = quantile, probs = 0.25, na.rm=TRUE )