Quantcast

macro function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

macro function

mrzung
hi,

I know how to use the "for" loop function like:

for(i in 1:ncol(mat)){
mat[i]<-b[i,2]
}

but, in this case

r1<-b[1,1]
r2<-b[2,1]
r3<-b[3,1]
r4<-b[4,1]

*
*
*

r3002<-b[3002,1]
r3003<-b[3003,1]

- must make vectors

how should I make a efficient code for that?

Is there anything in R like SAS MACRO function?

Please help me.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: macro function

Bert Gunter
On Mon, Feb 27, 2012 at 9:56 AM, mrzung <[hidden email]> wrote:

> hi,
>
> I know how to use the "for" loop function like:
>
> for(i in 1:ncol(mat)){
> mat[i]<-b[i,2]
> }
>
> but, in this case
>
> r1<-b[1,1]
> r2<-b[2,1]
> r3<-b[3,1]
> r4<-b[4,1]
>
> *
> *
> *
>
> r3002<-b[3002,1]
> r3003<-b[3003,1]
>
> - must make vectors
>
> how should I make a efficient code for that?

You shouldn't. There is no reason to do this.

>
> Is there anything in R like SAS MACRO function?

No! -- Thank goodness! R is a programming language to begin with. Have
you read "An Intro to R?' If not, why not? There are numerous
resources available on CRAN to help you. Use them.
>
> Please help me.
>

Please first make an effort to help yourself.

-- Bert

>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/macro-function-tp4425446p4425446.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
[hidden email] 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.
Loading...