s-news
[Top] [All Lists]

Re: Code that works outside a custom function but not inside

To: "Terry Therneau" <therneau@mayo.edu>
Subject: Re: Code that works outside a custom function but not inside
From: "s b" <sbmailinglist@gmail.com>
Date: Tue, 4 Nov 2008 14:09:39 -0500
Cc: s-news@lists.biostat.wustl.edu
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=ONk/ENf+iTkH7MkMfSqbtUu0Eh3z+VdljpRYYJ8ClD4=; b=X3q1Ip5yes0nFsXewLPrqwKwuDrfxbihx4JNjMh9anN6x1PNfdnhZzBtMS9hKspOZQ qfNiVFeDlW4nbheX9XAebAMC5RRziVPfMAkoAqsjucZjgTABj+cSIEelBiVSCa9HInBv GvDwt1OLHJsO14aOTRaabQBRfNFri1LK7N3fg=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=sYr6JmhJIY7xpEcysNktEyjCbQlfp2fT/YIZo2liMjsCCNAb3LS8yNQawP2+cJ7Nmz J0zFoj/CRwjn3GS0GbdeExhxx+eZmnM/bE7FuLyNTU1bACgDPpQwjpzrlY66b6fSlTrr 3YSgXsfKWjEpVS0YJw6Dj3xrnLxr9CCl+9HUI=
In-reply-to: <200810311307.m9VD7Ra14566@hsrnfs-101.mayo.edu>
References: <200810311307.m9VD7Ra14566@hsrnfs-101.mayo.edu>
Thanks everyone for your inputs.

FYI, I found in an old post a solution to my problem with which.panel (which strangely does not have the same behavior as in R!). In the following piece of script, pnl gives the index of the current panel and can be used e.g. to customize the text of the strips.

strip = function(...){
  pnl<-get('n',frame=sys.parent())
  ...
},

Sebastien

On Fri, Oct 31, 2008 at 8:07 AM, Terry Therneau <therneau@mayo.edu> wrote:
Your problem is the mixed-mode model statement

       histogram (~mydata[,1]|mydata[,2],
                     data = "">
                     ....

You want to either
       leave out the "data="" phrase
or use
       histogram(~ X|SD,
                  data="">

 Your first statement says "look in the 'mydata' frame for variable names",
but the mydata data frame does not have 'mydata[,1]' as one of its variable
names.  You can get away with this at the top level, where Splus can usually
find things even when given bad directions; but not inside a function.

       Terry T.



<Prev in Thread] Current Thread [Next in Thread>
  • Re: Code that works outside a custom function but not inside, s b <=