[R] SPlus to R
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Wed Oct 5 20:08:19 CEST 2011
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
More information about the R-help
mailing list