[R] Example Syntax for if - then- and - else Statements

Lanre Okusanya ooo at buffalo.edu
Wed May 17 19:16:42 CEST 2006

Hello R users,

I am a fairly new R user, however, one of the problems I am having is 
the use of applying if-, and-, then-, else- statements in R against 
datasets & dataframe. Rtips mentions it, but without simple examples I 
am not quite sure what my syntax should look like. I am particularly 
interested in syntax that can be used with the transform function. for 

    if foo[,1] == 'n', foo[,2] == 4, else foo[,2] == 6

Could someone please share simple example codes with different variants 
on the theme.

Lanre Okusanya, Pharm.D.,BCPS
UB/Pfizer Pharmacometrics Fellow
University at Buffalo School of Pharmacy and Pharmaceutical Sciences
237 Cooke Hall
Buffalo, NY 14260
Email: ooo at buffalo.edu
Tel: (716)645-2828 x 275
Fax: (716)645-2886

More information about the R-help mailing list