I have this array of values:
> df
[1] 2 0 0 2 2 0 0 1 0 1 2 1 0 1 3 0 0 1 1 0 0 0 2 1 2 1 3 1 0 0 0 1 1 2 0 1 3
[38] 1 0 2 1 1 2 2 1 2 2 2 1 1 1 2 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0
[75] 0 0 0 0 0 1 1 0 1 1 1 1 3 1 3 0 1 2 2 1 2 3 1 0 0 1
I want to use package boot to calculate the standard error of the data. http://www.ats.ucla.edu/stat/r/faq/boot.htm
So, I used this command to pursue:
library(boot)
boot(df, mean, R=10)
and I got this error:
Error in mean.default(data, original, ...) :
'trim' must be numeric of length one
Can someone help me figure out the problem? Thanks
If you are bootstrapping the mean you can do as follows:
If you just input the
mean
as an argument you will get the error like the one you got: