Re: [R] faster unlist,strsplit,gsub,for

2010-09-10 Thread Romain Francois
Hi, You can leverage read.table using a textConnection: txt - x,y,z,a,b,c,dda,b,c,d,e,f,gd con - textConnection( gsub( d, \\\n, txt ) ) read.table( con, sep = , ) V1 V2 V3 V4 V5 V6 V7 1 x y z a b c d 2 a b c d e f g close( con ) Romain Le 10/09/10 06:41, rajesh j a écrit :

[R] faster unlist,strsplit,gsub,for

2010-09-09 Thread rajesh j
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

Re: [R] faster unlist,strsplit,gsub,for

2010-09-09 Thread jim holtman
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

Re: [R] faster unlist,strsplit,gsub,for

2010-09-09 Thread rajesh j
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,dda,b,c,d,e,f,gd 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