I think you can use seq function:

seq(5)

On Wed, Feb 25, 2009 at 9:25 AM, Nash <morri...@ibms.sinica.edu.tw> wrote:

>
> Have the counter function in R ?
>
> if we use the software SAS
>
> /*** SAS Code **************************/
> data tmp(drop= i);
> retain seed x 0;
> do i = 1 to 5;
>        call ranuni(seed,x);
>        output;
> end;
> run;
>
> data new;
> counter=_n_;  ***** this keyword _n_ ****;
> set tmp;
> run;
>
> /*
> _n_ (Automatic variables)
> are created automatically by the DATA step or by DATA step statements.
> */
>
> /*** Output ********************************
> counter      seed             x
> 1       584043288                0.27197
> 2       935902963                0.43581
> 3       301879523                0.14057
> 4       753212598                0.35074
> 5       1607264573      0.74844
>
> ********************************************/
>
> Have a function like the "_n_" in R ?
>
>
> --
> Nash - morri...@ibms.sinica.edu.tw
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
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