On 17 Mar 2014, at 06:20 , Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote:

> Solution is to not use ifelse. Use if...else...

Specifically,

A <- if (x==2) B else C

(Newcomers may not immediately catch on to the fact that flow control 
statements in R are function calls with syntactic sugar, and that they return a 
value.)

-pd 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
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