Ok. These operations are on a string and the result is added to a
data.frame.
I have strings of the form
"x,y,z,a,b,c,d<d>a,b,c,d,e,f,g<d>
essentially comma separated values delimited by a <d>
I first do a
unlist(strsplit(string,split="<d>"))
and then a
strsplit(string,split=",")

The list of vectors i end up with is added row by row to a preallocated
data.frame like..
df[i,]<-list[[i]]

all of this is in a for loop and it runs for 1000 times atleast and the
strings are 7000 to 8000 characters in length



On Fri, Sep 10, 2010 at 9:14 AM, jim holtman <jholt...@gmail.com> wrote:

> First thing to do is to use Rprof to profile your code to see where
> the time is being spent, then you can make a decision as to what to
> change.  Are you carrying out the operations on a dataframe, if so can
> you change it to a matrix for some of the operations?  You have
> provided no idea of what your code or data looks like, or how often
> each of the operations is being done.
>
> There are probably many ways of speeding up the code, but with no idea
> of what the code is, no solutions can be specified.
>
> On Thu, Sep 9, 2010 at 11:09 PM, rajesh j <akshay.raj...@gmail.com> wrote:
> > Hi,
> >
> > I perform the operations unlist,strsplit,gsub and the for loop on a lot
> of
> > strings and its heavily slowing down the overall system. Is there some
> way
> > for me to speeden up these operations..maybe like alternate versions that
> > exist which use multiprocessors etc.
> >
> > --
> > Rajesh.J
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>



-- 
Rajesh.J

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to