[Rd] variables in nls (PR#829)

Uwe Ligges ligges@statistik.uni-dortmund.de
Sun, 28 Jan 2001 16:01:27 +0100 (CET)



On Sun, 28 Jan 2001 baron@cattell.psych.upenn.edu wrote:

> Full_Name: Jonathan Baron
> Version: 1.2.1
> OS: Linux
> Submission from: (NULL) (151.197.202.231)
> 
> 
> The following gives an error message:
> > nls(doit[2,] ~ 7/(1 + exp(a*efft[2,])),start=c(a=-.1))
> Error in as.name(varName) : attempt to use zero-length variable name
> 
> The following runs fine:
> > nls(doit.vm ~ 7/(1 + exp(a*efft.vm)),start=c(a=-.1))
> 
> This happens even though doit.vm and doit[2,] are identical (and efft[])
> 

Looks like a problem (?) with all.vars():

 temp <- matrix(1:4, 2)
 all.vars(temp ~ 3) # OK
[1] "temp"

 all.vars(temp[1, ] ~ 3) # Here is the problem. 
[1] "temp" ""

 all.vars(temp[1, TRUE] ~ 3) # works again
[1] "temp"


If this is expected (?), because of an implicitly given empty variable
name ([1, ThisOne]) for example, nls() has to be fixed:


Just insert after the lines
 
  varNames <- varNames[is.na(match(varNames, names(start),
        nomatch = NA))]

the line 

  varNames <- varNames[varNames != ""]



Uwe Ligges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._