Re: [R] Repeating a series of commands

2012-10-12 Thread Jessica Streicher
This is pretty confusing writeup, but if you have iterations, then yes, you need a loop or a recursion. A loop is probably easier, take a look at ?"for" or ?apply for this. there are several derivates of apply for example, say your outputs are what the code below gives you for each file,

Re: [R] Repeating a series of commands

2012-10-11 Thread Bert Gunter
encapsulate them into a function and call the function ?? -- Bert On Thu, Oct 11, 2012 at 11:09 AM, KoopaTrooper wrote: > I'm trying to figure out how to repeat a series of commands in R and have the > outputs added to a dataframe after each iteration. > > My code starts this way... > > a<-read.

[R] Repeating a series of commands

2012-10-11 Thread KoopaTrooper
I'm trying to figure out how to repeat a series of commands in R and have the outputs added to a dataframe after each iteration. My code starts this way... a<-read.csv("File1.csv") b<-read.csv("File2.csv") a$Z<-ifelse(a$Z=="L",sample(1:4,length(a$Z),replace=TRUE),ifelse(a$Z=="M",sample(5:8,lengt