[R] SPlus to R

William Dunlap wdunlap at tibco.com
Wed Oct 5 20:14:55 CEST 2011


I took the original code, changed all return()
calls of the form return(n1=v1,n2=v2) to
return(list(n1=v1,n2=v2)) and then sshc(10,100)
chugged away and produced some plots and returned
something with no errors.  It took a couple of minutes.

I also changed T->TRUE and F->FALSE, as that makes
the code a safer to use in R, where TRUE is a reserved
word but T is not.  

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Barry Rowlingson
> Sent: Wednesday, October 05, 2011 11:08 AM
> To: Scott Raynaud
> Cc: r-help at r-project.org
> Subject: Re: [R] SPlus to R
> 
> On Wed, Oct 5, 2011 at 4:54 PM, Scott Raynaud <scott.raynaud at yahoo.com> wrote:
> > It seems I have things set up correctly.  I suspect that the arguments
> > sshc(100,10) are the isuue.  It seems that the 100,10 is not necessary since
> > the code itself specifies the arguments.  It runs and produces a power curve
> > if I simply type sshc() but it also seems to try to keep running somethng as
> > I have to click stop to get back to a prompt in the console.
> >
> > Why specify 100,10?  There are 9 arguments, 3 which are required and the
> > rest optional.  Shouldn't I have to specify the 3 required arguments, nc, d
> > and method at a minimum?  It would look like sshc(nc=500, d=.5, method=3),
> > right?  I;m still not sure, however, why that would be necessary since it's
> > hard coded.
> 
> The sshc(10,100) was just some numbers I plucked out of nowhere. Your
> definition:
> 
> sshc<-function(rc, nc=500, d=.5, method=3, alpha=0.05, power=0.8,
> +              tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2), l.span=.5)
> 
> actually probably only needs the first value, the other parameters
> will take the defaults. sshc(10) should minimally run.
> 
> [[pedantic note
> I say probably because R code can look like this:
> 
>  foo = function(x){
>     if(missing(x)){x = 99}
>   ...
> }
> 
>  which is the same as foo = function(x=99){...} - so just because
> there's no default in the function definition it doesn't mean you have
> to supply it.
> end pedantic note]]
> 
>  Not sure why you have to click 'stop' - it might be that there's a
> couple of 'while' loops in there which might not be terminating.
> There's what looks like some debugging calls to 'cat' commented out -
> if you uncomment them you'll see what's going on, but you might not
> see them as they happen in Windows since I dont think the output isn't
> normally flushed immediately. There's probably an option you can set
> or a flush function you can call....
> 
> Barry
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list