In R there are a lot of functions which you can use in the "as."-version. I dont understand the difference. Example:
a <- c("a", "a", "a", "b", "b", "c")
b <- factor(a)
c <- as.factor(a)
identical(b, c)
identical(b, c)
will get TRUE. So at least in this case is no difference between as.factor
and factor
, both of them convert the character-vector a to a factor.
There are lots of similar examples (as.data.frame
and data.frame
, as.numeric
and numeric
, as.vector
and vector
, ...). Maybe somebody can explain the general difference of use between these.