My R
vector looks like this:
vector <- c(3, 2, 1, 4, 6, 2, 7)
I want to use the function tapply()
to calculate the mean
of the first 4 number
from the vector. How do I do it?
What did I do?
tapply(vector(1,4), mean)
but it seems like it does not work this way.
We need to use tapply()
function.