[R] an error in nlme package

David Winsemius dwinsemius at comcast.net
Mon Jul 13 17:59:41 CEST 2015


On Jul 13, 2015, at 8:36 AM, Sarah Goslee wrote:

> On Mon, Jul 13, 2015 at 11:19 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>> No, Sarah.
>> 
>> na.action must be a function, not a character string. But you're
>> close: there is no na.include function, as the message says.  It
>> should be na.exclude .
> 
> My apologies: I was assuming it worked like options():
> 
>> class(options()$na.action)
> [1] "character"
>> options()$na.action
> [1] "na.omit"

If such an option existed, then my understanding was that it would have an underlying function. But that's an inference from the various na.* functions that I find documented and vague memories of having seen code where there was a `get` or similar method of having a character value become a function name. I haven't actually tracked down the code for the substitution of function name for function value, since in the current instance it appears, looking first at `nlme.formula` and `model.frame.default`, that the character value gets sent to:

   External2(C_modelframe, ...)


Best;
 David.
> 
> Sarah
> 
>> 
>> Cheers,
>> Bert
>> 
>> 
>> Bert Gunter
>> 
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>>   -- Clifford Stoll
>> 
>> 
>> On Mon, Jul 13, 2015 at 7:35 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
>>> On Mon, Jul 13, 2015 at 3:04 AM, Patty Haaem via R-help
>>> <r-help at r-project.org> wrote:
>>>> Dear All,I am trying to fit one compartment IV bolus model on pharmacokinetic data using phenoModel function in nlme package, based on a tutorial entitled  "Development of population PK model using R- Case study I". The codes are as fallowing:
>>>> library(nlme)mydata.grp <- groupedData(CONC~TIME|CID,data=mydata)mydata.fit < -nlme(CONC~phenoModel(CID,TIME,AMT,lCl,lV),fixed=lCl+lV~1,random=pdDiag(lCl+lV~1), data=mydata.grp,start=c(-5,0),weight=varConstPower(const=1,fixed=list(power=1)),na.action=na.include,naPattern=~!is.na(CONC))
>>>> when I run above codes, I get the following error:Error in nlme.formula(CONC ~ phenoModel(CID, TIME, AMT, lCl, lV), fixed = lCl +  :   object 'na.include' not found
>>>> could you please tell me, how should I correct the codes?Thanks in advanceElham Haem
>>> 
>>> 
>>> First, you should not post in HTML.
>>> 
>>> Second, you should put the argument in quotes:
>>> 
>>> na.action="na.include"
>>> 
>>> 
>>> Sarah
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list