________________________________
De : Nash <morrison at ibms.sinica.edu.tw>
? : r-help <r-help at r-project.org>
Envoy? le : Mercredi, 25 F?vrier 2009, 13h25mn 18s
Objet?: [R] Have a function like the "_n_" in R ? (Automatic count
function )
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 - morrison at ibms.sinica.edu.tw
______________________________________________
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.
[[alternative HTML version deleted]]
______________________________________________
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.