[R] Iterations of random sampling

2009-03-11 Thread René Pineda
I have a univariate binary (1,0) 230,000 records, I need to make 20,000 iterations of random sampling of a fixed size. Where I put the result of the sum of selected records for each repetition Thank's _ of your life

Re: [R] Iterations of random sampling

2009-03-11 Thread Chuck Cleland
On 3/11/2009 3:15 PM, René Pineda wrote: I have a univariate binary (1,0) 230,000 records, I need to make 20,000 iterations of random sampling of a fixed size. Where I put the result of the sum of selected records for each repetition X - rbinom(23, 1, .5) sample.sums - replicate(2,

[R] Iterations

2008-07-15 Thread rkevinburton
I have a command that reads in some data: x - read.csv(Sales2007.dat, header=TRUE) Then I try to organize the data: sc - split(x, list(x$Category, x$SubCategory), drop=TRUE) Then I want to iterate through the data. I was able to get the following to run on the R console: for(i in

Re: [R] Iterations

2008-07-15 Thread Stephan Kolassa
Kevin, By default, many functions only *return* a result, they don't explicitly *print* it. There is no difference in interactive mode, but there is in batch mode (e.g., in loops). Use print() or cat() for explicit printing to console. for(i in 1:100) { cat(i,\n) } HTH, Stephan

Re: [R] Iterations

2008-07-15 Thread Jeff Newmiller
[EMAIL PROTECTED] wrote: I have a command that reads in some data: x - read.csv(Sales2007.dat, header=TRUE) Then I try to organize the data: sc - split(x, list(x$Category, x$SubCategory), drop=TRUE) Then I want to iterate through the data. I was able to get the following to run on the R

Re: [R] Iterations

2008-07-15 Thread Michael Rennie
for(1 in 1:10) { print(i) } Mike On Tue, Jul 15, 2008 at 1:11 PM, [EMAIL PROTECTED] wrote: I have a command that reads in some data: x - read.csv(Sales2007.dat, header=TRUE) Then I try to organize the data: sc - split(x, list(x$Category, x$SubCategory), drop=TRUE) Then I

Re: [R] Iterations

2008-07-15 Thread Michael Rennie
Oops, typo- sorry, should be for(i in 1:10) { print(i) } Mike On Tue, Jul 15, 2008 at 1:39 PM, Michael Rennie [EMAIL PROTECTED] wrote: for(1 in 1:10) { print(i) } Mike On Tue, Jul 15, 2008 at 1:11 PM, [EMAIL PROTECTED] wrote: I have a command that reads in

Re: [R] Iterations

2008-07-15 Thread Erik Iverson
If you read the help page, ?for, you might have seen under Value, that 'for', 'while' and 'repeat' return the value of the last expression evaluated (or 'NULL' if none was), invisibly. So if you want to see the values, print() them. In general, from the first part of your message, it

Re: [R] Iterations

2008-07-15 Thread rkevinburton
Sorry I missed the print part. When nothing was output I assumed that nothing happened. Thank you. Kevin Erik Iverson [EMAIL PROTECTED] wrote: If you read the help page, ?for, you might have seen under Value, that 'for', 'while' and 'repeat' return the value of the last

Re: [R] Iterations

2008-07-15 Thread rkevinburton
Thank you. ?for just gives me a + rompt indicating that I need to supply more input. The same with ?while and ?repeat. Help(for) yelds: help(for) Error: unexpected ')' in help(for) But thanks for the tip. Keivn Erik Iverson [EMAIL PROTECTED] wrote: If you read the help page, ?for,

Re: [R] Iterations

2008-07-15 Thread Erik Iverson
Sorry, I'm in ESS. Try ?Control [EMAIL PROTECTED] wrote: Thank you. ?for just gives me a + rompt indicating that I need to supply more input. The same with ?while and ?repeat. Help(for) yelds: help(for) Error: unexpected ')' in help(for) But thanks for the tip. Keivn Erik Iverson

Re: [R] Iterations

2008-07-15 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 12:40 PM To: Erik Iverson Cc: [EMAIL PROTECTED] Subject: Re: [R] Iterations Thank you. ?for just gives me a + rompt indicating that I need

Re: [R] Iterations

2008-07-15 Thread Rolf Turner
On 16/07/2008, at 7:40 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thank you. ?for just gives me a + rompt indicating that I need to supply more input. The same with ?while and ?repeat. Help(for) yelds: help(for) Error: unexpected ')' in help(for) But thanks for the tip.