Re: [R] Error in model.frame: invalid variable type

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 26 Jun 2006 - 04:58:07 EST

What are the names of 'data?' It looks like you intended the response to be data$Response and not the object response found in your workspace. If so, you need to capitalize your formula.

(And what version of R is this? -- R-devel actually tells you the type in this error message, so we know it is not that.)

BTW, 'data' is an R system object and you really should avoid using the name for your own data frames. Normally R works out what you mean, but this can be cause of hard-to-find errors.

On Sun, 25 Jun 2006, Brian Davenhall wrote:

> I'm getting the following error when trying to execute a glm() procedure:
>
> Error in model.frame(formula, rownames, variables, varnames, extras,
> extranames, :
> invalid variable type for 'response'
>
> The commands I'm using to import the *.csv files, construct the data frame,
> and run the glm procedure are below:
>
> response <- read.csv("Response.csv", header = TRUE, sep = ",")
>
> seed <- read.csv("Seed.csv", header = TRUE, sep = ",")
>
> data <- data.frame(seed, response)
>
> model <- glm(response~seed, family=binomial(link=logit), data=data)
>
>
>
> My Response.csv files look like this:
>
>
>
> Response
>
> 0
>
> 0
>
> 1
>
> ...
>
>
>
> My Seed.csv files look like this:
>
>
>
> Seed
>
> 0.25
>
> 0.65
>
> 0.47
>
> ....
>
>
>
> Thanks in advance for any help,
>
> Brian
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Jun 26 05:02:03 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 26 Jun 2006 - 06:11:50 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.