Re: [R] If/then statement, if in a list then

2012-07-30 Thread Bert Gunter
Sorry, one error: On Mon, Jul 30, 2012 at 1:18 PM, Bert Gunter wrote: > ?? > > On Mon, Jul 30, 2012 at 11:46 AM, R. Michael Weylandt > wrote: >> On Mon, Jul 30, 2012 at 8:49 AM, Bert Gunter wrote: >>> Not necessarily. If the OP really meant the R list() structure, then >>> is.element does not a

Re: [R] If/then statement, if in a list then

2012-07-30 Thread Bert Gunter
?? On Mon, Jul 30, 2012 at 11:46 AM, R. Michael Weylandt wrote: > On Mon, Jul 30, 2012 at 8:49 AM, Bert Gunter wrote: >> Not necessarily. If the OP really meant the R list() structure, then >> is.element does not apply. > > Perhaps... > > x <- list(1:5, "a", `+`, rnorm, NULL, list(letters)) Not

Re: [R] If/then statement, if in a list then

2012-07-30 Thread Rui Barradas
Hello, Em 30-07-2012 19:46, R. Michael Weylandt escreveu: On Mon, Jul 30, 2012 at 8:49 AM, Bert Gunter wrote: Not necessarily. If the OP really meant the R list() structure, then is.element does not apply. Perhaps... x <- list(1:5, "a", `+`, rnorm, NULL, list(letters)) letters %in% x # Work

Re: [R] If/then statement, if in a list then

2012-07-30 Thread R. Michael Weylandt
On Mon, Jul 30, 2012 at 8:49 AM, Bert Gunter wrote: > Not necessarily. If the OP really meant the R list() structure, then > is.element does not apply. Perhaps... x <- list(1:5, "a", `+`, rnorm, NULL, list(letters)) letters %in% x # Works -- vectorized, mostly false, but the "a" is there, per b

Re: [R] If/then statement, if in a list then

2012-07-30 Thread Bert Gunter
Not necessarily. If the OP really meant the R list() structure, then is.element does not apply. If a vector was what was intended, then it does -- provide all elements are of the same mode. With such a vague post, it's hard to know. -- Bert On Mon, Jul 30, 2012 at 6:06 AM, Jean V Adams wrote: >

Re: [R] If/then statement, if in a list then

2012-07-30 Thread cm
Thank you so much Jean! -- View this message in context: http://r.789695.n4.nabble.com/If-then-statement-if-in-a-list-then-tp4638346p4638351.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

Re: [R] If/then statement, if in a list then

2012-07-30 Thread Jean V Adams
?is.element Jean cm wrote on 07/30/2012 07:55:34 AM: > > I need to write an if/then statement saying something along the lines of: > if (VALUE is in list) {... > How do I write that in R's language. > Thanks! [[alternative HTML version deleted]] _

Re: [R] If/then statement, if in a list then

2012-07-30 Thread John Kane
if(cond) expr if(cond) cons.expr else alt.expr Also see ?ifelse John Kane Kingston ON Canada > -Original Message- > From: bunnylove...@optonline.net > Sent: Mon, 30 Jul 2012 05:55:34 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] If/then statement, if in a l

[R] If/then statement, if in a list then

2012-07-30 Thread cm
I need to write an if/then statement saying something along the lines of: if (VALUE is in list) {... How do I write that in R's language. Thanks! -- View this message in context: http://r.789695.n4.nabble.com/If-then-statement-if-in-a-list-then-tp4638346.html Sent from the R help mailing list a