[R] R beginner - Error in as.vector(x, mode)

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Mar 10 23:29:56 CET 2011


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Arne Henningsen
> Sent: Thursday, March 10, 2011 12:09 PM
> To: Alex Olssen; r-help at r-project.org
> Subject: Re: [R] R beginner - Error in as.vector(x, mode)
> 
> Dear Alex
> 
> On 10 March 2011 20:31, Alex Olssen <alex.olssen at gmail.com> wrote:
> > I find it hard to provide a reproducible version of this error.
> > When I use the exact same procedure but get data from data()
> > everything works fine.
> > I.e., I do not think the startvals are the problem - in fact I copied
> > the syntax for the startvals directly from the example in the
> > documentation which does work.
> >
> > The following code is very similar to my code above.
> > The important difference is the way the data is obtained.
> > This code works.
> >
> > library(systemfit)
> > library(foreign)
> > data("mtcars")
> > eqDrat <- drat ~ a0 + a1*mpg + a2*qsec
> > eqWt <- wt ~ b0 + b1*mpg + b2*qsec
> > model <- list(eqDrat, eqWt)
> > start.values <- c(a0=0.5, a1=0.5, a2=0, b0=0.5, b1=0.5, b2=0)
> > nlsystemfit("OLS", model, start.values, data = mtcars)
> >
> > I think I could solve my problem if I could use my data through
> data()
> > instead of through read.table()
> > Does anyone know if this is possible?
> 

I tried to send this response from my phone, but no luck. :-(  Anyway, in the OP's original post, the call to nlsystemfit used data=auto, i.e.

nlsystemfit("OLS", model, start.values, data = auto) 

instead of data=auto74.

Could that be the source of the problem?

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204




More information about the R-help mailing list