[R] apologes if you already saw this :efficiency question

From: <markleeds_at_verizon.net>
Date: Thu 06 Jul 2006 - 07:33:24 EST

hi everyone : i'm not sure if my previous mail about this got sent. i was typing and
erroneosuyl hit a button and lost what i was typing.

anyway, i have the code below ( it works ) in which i run through the rows of a dataframe, taking out the first two fields which are characters strings ( with some extra spacing so i yuse gsub) and appending these character strings to a list so that i can build one big list.

there are 17,000 rows so i was hoping there might be a ( even just slightly. it doesn't have to be incresible improvement ) more efficient way to do this. I also think that remember someone saying that using the c command to make something bigger is not a good idea.

the code is below. thanks.

              for paircounter in 1:nrow(tempdata) {

                 firsstock<-gsub(" ","",tempdata[paircounter,1]
                 secondstock<-gsub(" ","",tempdata[paircounter,2]

                  if ( paircounter == 1 ) {
                   } else {

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 06 07:40:17 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 06 Jul 2006 - 14:16:34 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.