[R] Can't understand error message :-{

Stuart Luppescu s-luppescu at uchicago.edu
Tue Mar 2 17:10:03 CET 1999

I'm sorry if this is a basic question, but I'm stumped. I'm just trying to plot
the residuals from a linear model against another variable in the data frame.
Here are the lines I'm trying to execute:

size <- read.table(file="/u67/abasl70/surveys/annenberg/mega/smschl.dat",
sizef <- data.frame(size, row.names=size$unit)
mschmod <- lm (mavgres ~ crimesch + socstat + povnojob + ploinc94 + aa94 +
hisp94 + minty94 + mixed94, data=sizef)
plot(mschmod$residuals ~ size94)

The last line gives this error message:
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  : variable lengths differ

In fact, the lengths are different:
> length(mschmod$residuals)
[1] 379
> length(size94)
[1] 384

but I'm sure I don't know 1) how this happened since it all came from the same
data frame, or 2) why it should prevent me from plotting the data. If someone
can tell me how to fix this (before I have to present the results at this
Thursday's meeting!) I'd be very appreciative. 
Stuart Luppescu         -=-=-  University of Chicago
ºÍʸ ¤ÈÃÒÆàÈþ¤ÎÉã(EUC)  -=-=-  s-luppescu at uchicago.edu
ICQ #21172047  AIM: psycho7070
Bare feet magnetize sharp metal objects so they point upward from the
floor -- especially in the dark.
>> Sent on 02-Mar-99 at 10:00:07 with xfmail
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list