Displaying 1 result from an estimated 1 matches for "monthfac".
Did you mean:
monthcal
2010 Mar 22
2
Problem with factors in lm() when using Rscript but not GUI
...###
#tnp2.r - contents of tnp2.r script file are below
print(R.Version()$version.string)
#generate some data
x <- rep(c(1:12),3)
y <- 1:length(x)+rnorm(length(x))
print(x)
print(y)
#this bit works OK
xtemp <- lm(y ~ x )
print(xtemp)
print("got to here (without factor part)")
monthfac <- as.factor(x)
print(monthfac)
#this line below causes probs in R v2.10.1 when run from Rscript.....
xtemp2 <- lm(y ~ monthfac)
print(xtemp2)
stop("stopped on purpose",call.=F)
#end of file tnp2.r
###############################################
#error message is thus:
Error...