Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Thomas Lumley wrote: > On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote: > >> >> thanks for the explanation. for the sake of rvalues, please do not fix >> this bug. i find it useful to avoid messing with = and <-. >> > > If you insist on calling it a bug, the chances of its getting fixed > are higher

Re: [R] If statement generates two outputs

2009-03-24 Thread Thomas Lumley
On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote: thanks for the explanation. for the sake of rvalues, please do not fix this bug. i find it useful to avoid messing with = and <-. If you insist on calling it a bug, the chances of its getting fixed are higher. -thomas Thomas Lumley

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Thomas Lumley wrote: > On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote: > >> thanks. so it seems to be intentionally parsable, though i wouldn't say >> that this gives a meaning to ':=' -- the operator has a syntactic >> category, but no semantics. the syntactic category does not imply any >> semant

Re: [R] If statement generates two outputs

2009-03-24 Thread Thomas Lumley
On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote: thanks. so it seems to be intentionally parsable, though i wouldn't say that this gives a meaning to ':=' -- the operator has a syntactic category, but no semantics. the syntactic category does not imply any semantics, as in '<-' = function(a,

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Romain Francois wrote: > This is probably due to that in the gram.y file : > > case ':': >if (nextchar(':')) { >if (nextchar(':')) { >yylval = install(":::"); >return NS_GET_INT; >} >else { >yylval = install("::"); >return NS_GET; >

Re: [R] If statement generates two outputs

2009-03-24 Thread Romain Francois
Wacek Kusnierczyk wrote: Berwin A Turlach wrote: G'day Carl, On Mon, 23 Mar 2009 20:11:19 -0400 Carl Witthoft wrote: But seriously: can someone explain to me what's going on in the rvalues.r code? I tried a simple experiment, replacing ":=" with a "colec" in the code, and of c

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Carl, > > On Mon, 23 Mar 2009 20:11:19 -0400 > Carl Witthoft wrote: > > > >> But seriously: can someone explain to me what's going on in the >> rvalues.r code? I tried a simple experiment, replacing ":=" with a >> "colec" in the code, and of course the line >

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Carl, > > On Mon, 23 Mar 2009 20:11:19 -0400 > Carl Witthoft wrote: > > >> >From: Wacek Kusnierczyk >> >Date: Sun, 22 Mar 2009 22:58:49 +0100 >> >> >> >just for fun, you could do this with multiassignment, e.g., using >> >the (highly experimental and prematu

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Carl, > > On Mon, 23 Mar 2009 20:11:19 -0400 > Carl Witthoft wrote: > > >> >From: Wacek Kusnierczyk >> >Date: Sun, 22 Mar 2009 22:58:49 +0100 >> >> >> >just for fun, you could do this with multiassignment, e.g., using >> >the (highly experimental and prematu

Re: [R] If statement generates two outputs

2009-03-23 Thread Berwin A Turlach
G'day Carl, On Mon, 23 Mar 2009 20:11:19 -0400 Carl Witthoft wrote: > >From: Wacek Kusnierczyk > >Date: Sun, 22 Mar 2009 22:58:49 +0100 > > > >just for fun, you could do this with multiassignment, e.g., using > >the (highly experimental and premature!) rvalues: > > >source('http://m

Re: [R] If statement generates two outputs

2009-03-23 Thread Carl Witthoft
>From: Wacek Kusnierczyk >Date: Sun, 22 Mar 2009 22:58:49 +0100 >just for fun, you could do this with multiassignment, e.g., using the >(highly experimental and premature!) rvalues: >source('http://miscell.googlecode.com/svn/rvalues/rvalues.r') >if (TRUE) > c(df1, df2) := list(4

Re: [R] If statement generates two outputs

2009-03-23 Thread Wacek Kusnierczyk
jimdare wrote: > Hi, > > I tried to create the following if / else statement but I keep getting the > error "Error: unexpected '}' in "size="large",center="none") > }" (I have highlighted the } in bold where the error is occuring). I can't > seem to find a reason for this, does anyone know how I

Re: [R] If statement generates two outputs

2009-03-22 Thread jim holtman
You appear to have a number of unbalanced parentheses in your statements. Here is one that seems to work: if (nostocks<=3) {data1<-test[,data1stocks]; tex1<-latex(data1, file=paste(i$Species[1], "1.tex", sep=""), rowname = NULL,

Re: [R] If statement generates two outputs

2009-03-22 Thread jimdare
Hi, I tried to create the following if / else statement but I keep getting the error "Error: unexpected '}' in "size="large",center="none") }" (I have highlighted the } in bold where the error is occuring). I can't seem to find a reason for this, does anyone know how I can fix it? Thanks, Jame

Re: [R] If statement generates two outputs

2009-03-22 Thread Wacek Kusnierczyk
jimdare wrote: > Thanks very much > > you're welcome. just for fun, you could do this with multiassignment, e.g., using the (highly experimental and premature!) rvalues: source('http://miscell.googlecode.com/svn/rvalues/rvalues.r') if (TRUE) c(df1, df2) := list(4:8, 9:13)

Re: [R] If statement generates two outputs

2009-03-22 Thread jimdare
Thanks very much Wacek Kusnierczyk wrote: > > jimdare wrote: >> Hi, >> >> How do I tell an if statement to generate two seperate outputs. >> >> E.g If X>5 I want to create df1 and df2: >> >> if (X>5) {df1<-c(4,5,6,7,8) AND df2<-c(9,10,11,12,13)} >> > almost there: > > if (X>5) {df1<-

Re: [R] If statement generates two outputs

2009-03-22 Thread Daniel Moreira
if (X>5) { df1<-c(4,5,6,7,8) df2<-c(9,10,11,12,13) } hth, Daniel Moreira, MD jimdare Sent by: r-help-boun...@r-project.org 03/22/2009 05:27 PM To r-help@r-project.org cc Subject [R] If statement generates two outputs Hi, How do I tell an if statement to generate two

Re: [R] If statement generates two outputs

2009-03-22 Thread Wacek Kusnierczyk
jimdare wrote: > Hi, > > How do I tell an if statement to generate two seperate outputs. > > E.g If X>5 I want to create df1 and df2: > > if (X>5) {df1<-c(4,5,6,7,8) AND df2<-c(9,10,11,12,13)} > almost there: if (X>5) {df1<-c(4,5,6,7,8); df2<-c(9,10,11,12,13)} vQ

[R] If statement generates two outputs

2009-03-22 Thread jimdare
Hi, How do I tell an if statement to generate two seperate outputs. E.g If X>5 I want to create df1 and df2: if (X>5) {df1<-c(4,5,6,7,8) AND df2<-c(9,10,11,12,13)} Thanks, James -- View this message in context: http://www.nabble.com/If-statement-generates-two-outputs-tp22650844p22650844.htm