Re: [R] function output with for loop and if statement

2009-04-23 Thread Richard M. Heiberger
tmp.out.sort <- tmp.out[, order(names(tmp.out))] tmp.out.sort <- tmp.out[, order(names(tmp.out)), drop=FALSE] >From your description of misbehavior with a single column, I think the drop=FALSE argument will provide the protection you need. Then you will not need the if clause. See ?`[.data.fram

Re: [R] function output with for loop and if statement

2009-04-23 Thread aaron wells
Sedges Vascular > Subject: Re: [R] function output with for loop and if statement > From: gavin.simp...@ucl.ac.uk > To: awell...@hotmail.com > CC: r-help@r-project.org > Date: Thu, 23 Apr 2009 09:18:17 +0100 > > On Wed, 2009-04-22 at 15:51 -0400, aaron wells wrote: >>

Re: [R] function output with for loop and if statement

2009-04-23 Thread Gavin Simpson
: markle...@verizon.net > To: awell...@hotmail.com > Subject: Re: [R] function output with for loop and if statement > > Hi Aaron: i just looked quickly because I have to go but try wrapping braces > around the last if else like > below and see if that helps. if you have multiple st

Re: [R] function output with for loop and if statement

2009-04-23 Thread Gavin Simpson
On Wed, 2009-04-22 at 15:51 -0400, aaron wells wrote: > Hello all, turns out i'm having a bad R week. I am at my wits end > with a function that I am trying to write. When I run the lines of > code outside of a function, I get the desired output. When I wrap the > lines of code into a function i

Re: [R] function output with for loop and if statement

2009-04-22 Thread aaron wells
2009 15:24:24 -0500 From: markle...@verizon.net To: awell...@hotmail.com Subject: Re: [R] function output with for loop and if statement Hi Aaron: i just looked quickly because I have to go but try wrapping braces around the last if else like below and see if that helps. if you have multiple

[R] function output with for loop and if statement

2009-04-22 Thread aaron wells
Hello all, turns out i'm having a bad R week. I am at my wits end with a function that I am trying to write. When I run the lines of code outside of a function, I get the desired output. When I wrap the lines of code into a function it doesn't work as expected. Not sure what is going on her