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

From: Lanre Okusanya <ooo_at_buffalo.edu>
Date: Thu 18 May 2006 - 03:16:42 EST


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 example

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

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

-- 
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@buffalo.edu
Tel: (716)645-2828 x 275
Fax: (716)645-2886

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu May 18 03:24:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 18 May 2006 - 04:10:13 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.