[R] c++ equivalent 'default' case in switch

2010-10-06 Thread raje...@cse.iitm.ac.in
Hi, Is there a c++ equivalent default case in the switch command? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] c++ equivalent 'default' case in switch

2010-10-06 Thread Henrique Dallazuanna
Yes, switch('d', b = 1, 'default') On Wed, Oct 6, 2010 at 8:43 AM, raje...@cse.iitm.ac.in raje...@cse.iitm.ac.in wrote: Hi, Is there a c++ equivalent default case in the switch command? [[alternative HTML version deleted]] __

Re: [R] c++ equivalent 'default' case in switch

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 8:42 AM, Henrique Dallazuanna wrote: Yes, switch('d', b = 1, 'default') ?switch For numeric arguments, the OP would need to construct a wrapper that tested for a NULL return. switch(2, b = 1, 'default') [1] default switch(4, b = 1, 'default') is.null(switch(4, b

Re: [R] c++ equivalent 'default' case in switch

2010-10-06 Thread Henrique Dallazuanna
Or convert the EXPR to character : x - 5 switch(as.character(x), '2' = 3, 'default') On Wed, Oct 6, 2010 at 9:57 AM, David Winsemius dwinsem...@comcast.netwrote: On Oct 6, 2010, at 8:42 AM, Henrique Dallazuanna wrote: Yes, switch('d', b = 1, 'default') ?switch For numeric arguments,