Timothy Bates
2012-Feb-06 17:42 UTC
[R] na.action in stats::factanal() must be using formula interface and dataframe input to specify na.action?
hi, Does factanal() force the user to use the formula interface if they wish to specify an na.action? v1 <- c(1,1,1,1,1,1,1,1,NA,1,3,3,3,3,3,4,5,6) v2 <- c(1,2,1,1,1,1,2,1,2,1,3,NA,3,3,3,4,6,5) v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6) v4 <- c(3,3,4,NA,3,1,1,2,1,1,1,1,2,NA,1,5,6,4) v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5) v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4) m1 <- data.frame(cbind(v1,v2,v3,v4,v5,v6)) factOut = factanal(m1, factors = 1,scores = "Bartlett", na.action="na.exclude") factOut = factanal(~v1+v2+v3+v4+v5+v6, data=m1, factors = 1,scores = "Bartlett", na.action="na.exclude")
Uwe Ligges
2012-Feb-08 19:20 UTC
[R] na.action in stats::factanal() must be using formula interface and dataframe input to specify na.action?
On 06.02.2012 18:42, Timothy Bates wrote:> hi, > Does factanal() force the user to use the formula interface if they wish to specify an na.action?Yes, as the help page says: "na.action: The ?na.action? to be used if ?x? is used as a formula." Uwe Ligges> v1<- c(1,1,1,1,1,1,1,1,NA,1,3,3,3,3,3,4,5,6) > v2<- c(1,2,1,1,1,1,2,1,2,1,3,NA,3,3,3,4,6,5) > v3<- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6) > v4<- c(3,3,4,NA,3,1,1,2,1,1,1,1,2,NA,1,5,6,4) > v5<- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5) > v6<- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4) > m1<- data.frame(cbind(v1,v2,v3,v4,v5,v6)) > factOut = factanal(m1, factors = 1,scores = "Bartlett", na.action="na.exclude") > factOut = factanal(~v1+v2+v3+v4+v5+v6, data=m1, factors = 1,scores = "Bartlett", na.action="na.exclude") > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.