Re: [R] For loop output

2013-08-09 Thread Jenny Williams
: David Carlson [mailto:dcarl...@tamu.edu] Sent: 08 August 2013 18:04 To: Jenny Williams; r-help@r-project.org Subject: RE: [R] For loop output It's not clear how you are planning to use this within R, but you don't need a loop. individual.proj.quote - capture.output(write.table(matrix

Re: [R] For loop output

2013-08-09 Thread Jan Kim
: 995 -Original Message- From: David Carlson [mailto:dcarl...@tamu.edu] Sent: 08 August 2013 18:04 To: Jenny Williams; r-help@r-project.org Subject: RE: [R] For loop output It's not clear how you are planning to use this within R, but you

Re: [R] For loop output

2013-08-09 Thread David Carlson
-help@r-project.org Subject: RE: [R] For loop output To update on the use of this little string, I am trying to use it to automate files to be loaded into a raster stack. I think the issue I have with the string is related to the backslashes. I need to just read the pure text so that the datasets can

[R] For loop output

2013-08-08 Thread Jenny Williams
I am having difficulty storing the output of a for loop I have generated. All I want to do is find all the files that I have, create a string with all of the names in quotes and separated by commas. This is proving more difficult than I initially anticipated. I am sure it is either very simple

Re: [R] For loop output

2013-08-08 Thread Charles Determan Jr
Hi Jenny, Firstly, to my knowledge you cannot assign the output of cat to an object (i.e. it only prints it). Second, you can just add the 'collapse' option of the paste function. individual.proj.quote - paste(individual.proj, collapse = ,) if you really want the quotes individual.proj.quote -

Re: [R] For loop output

2013-08-08 Thread Jan Kim
On Thu, Aug 08, 2013 at 04:05:57PM +0100, Jenny Williams wrote: I am having difficulty storing the output of a for loop I have generated. All I want to do is find all the files that I have, create a string with all of the names in quotes and separated by commas. This is proving more difficult

Re: [R] For loop output

2013-08-08 Thread Jan Kim
On Thu, Aug 08, 2013 at 11:38:33AM -0500, Charles Determan Jr wrote: Hi Jenny, Firstly, to my knowledge you cannot assign the output of cat to an object (i.e. it only prints it). Second, you can just add the 'collapse' option of the paste function. individual.proj.quote -

Re: [R] For loop output

2013-08-08 Thread David Carlson
: Thursday, August 8, 2013 10:06 AM To: 'r-help@r-project.org' Subject: [R] For loop output I am having difficulty storing the output of a for loop I have generated. All I want to do is find all the files that I have, create a string with all of the names in quotes and separated by commas

Re: [R] For loop output

2013-08-08 Thread MacQueen, Don
If I understand the request correctly, here is an easy to follow example: (I'm using the first four letters as surrogates for the file names) (and assuming we want quotes at both the beginning and the end) tmp - letters[1:4] tmp [1] a b c d foo - paste( ', paste(tmp,collapse=','), ', sep='')

[R] for loop output

2012-10-17 Thread stats12
Dear R users, In the code below, I am trying to print the result of my loop function. The output first gives me the result for k=1, and then for k=1 and k=2. I only want the last output which is [,1] [,2] [1,] 0.1700065 0.5002659 [2,] 0.3080273 0.4954731 [3,] 0.4844886

Re: [R] for loop output

2012-10-17 Thread Sarah Goslee
At the end of the loop, the last output should be stored in int, so int will give it to you. You don't need the print(int) within the loop unless you like to verify that the loop is working. Sarah On Wed, Oct 17, 2012 at 2:16 PM, stats12 ska...@gmail.com wrote: Dear R users, In the code

[R] Storing loop output in matrix

2011-01-31 Thread Dean Castillo
Hello I am trying to store output from a loop into an empty matrix. The current code I am using is: M-mat.or.vec(11,89) for (j in list(3,91)) + {M[,(j-2)]-pic(datain[,j], mytree)} datain is a matrix (11,91). I only want to use the pic() function on the columns 3:91. When I use this code output

Re: [R] Storing loop output in matrix

2011-01-31 Thread David Winsemius
On Jan 31, 2011, at 4:49 PM, Dean Castillo wrote: Hello I am trying to store output from a loop into an empty matrix. The current code I am using is: M-mat.or.vec(11,89) R code to create a matix would use the matrix function, for (j in list(3,91)) + {M[,(j-2)]-pic(datain[,j], mytree)}

Re: [R] Storing loop output in matrix

2011-01-31 Thread Peter Ehlers
On 2011-01-31 13:49, Dean Castillo wrote: Hello I am trying to store output from a loop into an empty matrix. The current code I am using is: M-mat.or.vec(11,89) for (j in list(3,91)) + {M[,(j-2)]-pic(datain[,j], mytree)} datain is a matrix (11,91). I only want to use the pic() function on