apply function (Bitwise "and") on each cell of a raster in R? -


what best way "bitwise and" on pixels in raster (maybe using "raster" package)? want check if sixth bit set.

if given integer, use r's bitwand operator. 'and' 32 (has sixth bit set) , see if result 0 or otherwise. example: bitwand(96,32) # 32, has sixth bit set bitwand(192,32) # 0, not have sixth bit set

i tried bitwand(myraster,32l) not work.

thanks! r.

for operations on each cell of raster, can use function calc of library raster. in case, be:

r.test <- calc(myraster, fun = function(x) bitwand(x,32l)) 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -