[R] Looping Over Data Frames
Sparks, John James
jspark4 at uic.edu
Tue Apr 30 03:03:41 CEST 2013
Dear R Helpers,
I am re-phrasing a question that I put forth earlier today due to some
particulars in the solution that I am searching for. Many thanks to those
who answered the previous post and to any who would be willing to answer
this one.
I have a set of data frames. I need to perform some data scrubbing on
each of them. I am trying to figure out how to perform the same steps on
each data frame using some sort of loop or something along those lines.
Because my actual data frames are quite large and the steps I am taking
moderately complicated, I would very much prefer not to put them all
together in a list because when I get an error, I can't determine which
part of the list is the source of the error. So, I would really
appreciate it if someone could post a way to perform the following sub
setting function on the three simple data frames in the example below with
some sort of loop or something along those lines, which would work
directly on the data frames in question.
Many thanks in advance. Please let me know if there is anything I can do
to make the question more clear.
--John Sparks
x=as.data.frame(matrix(c(1,2,3,
1,2,3,
1,2,2,
1,2,2,
1,1,1),ncol=3,byrow=T))
y=as.data.frame(matrix(c(1,2,3,
1,2,3,
1,2,2,
1,2,2,
1,1,1),ncol=3,byrow=T))
z=as.data.frame(matrix(c(1,2,3,
1,2,3,
1,2,2,
1,2,2,
1,1,1),ncol=3,byrow=T))
#Want to build some sort of loop for this.
x<-subset(x,select=-c(V1))
y<-subset(y,select=-c(V1))
z<-subset(z,select=-c(V1))
More information about the R-help
mailing list