[R] How to speed up int2bin conversion?

2011-12-01 Thread Jonas Jägermeyr
Dear R-help members, I'm processing a large amount of MODIS data where quality assessment information is stored as an integer value for each pixel. I have to converted this number to an 8 digit binary flag to get access to the stored quality code (e.g. in2bin(165,8) = 1 0 1 0 0 1 0 1).

Re: [R] How to speed up int2bin conversion?

2011-12-01 Thread jim holtman
If we assume that you are just convert 8 bits, here is one way with a table lookup. If more than 8 bits, just partition the data and repeat. This sets up a mapping table one time for the lookup. Does 1M in 0.3 seconds on my computer; is this fast enough? # initialize a matrix with 8 bit

Re: [R] How to speed up int2bin conversion?

2011-12-01 Thread Jonas Jägermeyr
On 12/01/2011 02:46 PM, jim holtman wrote: If we assume that you are just convert 8 bits, here is one way with a table lookup. If more than 8 bits, just partition the data and repeat. This sets up a mapping table one time for the lookup. Does 1M in 0.3 seconds on my computer; is this fast

Re: [R] How to speed up int2bin conversion?

2011-12-01 Thread Jeff Newmiller
You might be interested in package bit. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...