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

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 25 20:58:07 CEST 2006


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 at 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 at 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



More information about the R-help mailing list