Skip to content
Prev 1813 / 7420 Next

change values of a vector selectively

Mango,
I believe what you have is the right idea. There are some things you could do that might speed it up. For example, don't search for c('B',1,2), r will need to convert those all to characters first. Instead ask if exp$marker=='0'. Another thing you could do is create an empty vector to store the results and then replace the column after it's done, that's a lot of work to look up the position every time and then replace it. It might also be slow because they are all characters. In that case you might convert them to numbers with something like an ifelse statement but that probably would not save much in the end.

-Chris
On Jan 11, 2011, at 6:58 AM, "B.-Markus Schuller" <b.markus.schuller at googlemail.com> wrote: