I used the following function to find standard error of variables. but when I run the same function now, it is not working.
st.err <- function(x) {
sd(x)/sqrt(length(x))
}
I am getting an error while running this command.
Error in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) : Calling var(x) on a factor x is defunct. Use something like 'all(duplicated(x)[-1L])' to test for a constant vector. Calls: ... std.error -> unlist -> sapply -> lapply -> FUN -> var Execution halted
My Rstudio is up to date, as well as all the packages I use. Could any of you suggest an alternate function to get standard error?
Varadhu