On Wed, Oct 5, 2011 at 2:53 AM, Scott Raynaud <scott.rayn...@yahoo.com> wrote:
> I'm trying to convert an S-Plus program to R.  Since I'm a SAS programmer I'm 
> not facile is either S-Plus or R, so I need some help.  All I did was convert 
> the underscores in S-Plus to the assignment operator <-.  Here are the first 
> few lines of the S-Plus file:
>
> sshc _ function(rc, nc, d, method, alpha=0.05, power=0.8,
>              tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2), l.span=.5)
> {
> ### for method 1
> if (method==1) {
> ne1 _ ss.rand(rc,nc,d,alpha=.05,power=.8,tol=.01)
> return(ne=ne1)
>                }
>
>
> My translation looks like this:
>
> 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)
> {
> ### for method 1
> if (method==1) {
>  ne1<-ss.rand(rc,nc,d,alpha=.05,power=.8,tol=.01)
>  return(ne=ne1)
>                }
>
> The program runs without throwing errors, but I'm not getting any ourput in 
> the console.  This is where it should be, right?  I think I have this set up 
> correctly.  I'm using method=3 which only requires nc and d to be specified.  
> Any ideas why I'm not seeing output?

 Long shot: the code you posted looked like (and hard to tell without
indentation) just a bunch of function definitions. R won't actually do
anything unless you call those functions with some parameters.

 So, when you say you get no output when you 'run' the code, what
exactly do you mean by 'run' the code? What I would do is:

 1. Put the code in a file called 'whatever.R'.
 2. Start R, and do source("whatever.R"). That defines the functions.
do "ls()" and you should see them.
 3. Call one of the functions: sshc(100,10)

I'd call that, in R terms, "calling the sshc function" rather than
running anything.

Barry

______________________________________________
R-help@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.

Reply via email to