You can use EBImage package to load rasters.
Suppose your raster is loaded at image object:

len = sum(image == 2) # number of pixels with value 2
image[sample(which(image == 2), round(len * 0.25)) ] = 3


2012/7/3 Frederico Mestre <mestre.frederico@gmail.com>

> Hello:
>
>
>
> I've got a raster generated with the raster package. I want to randomly
> change the value of  pixels of a given value.
>
>
>
> For example, I want to select 25% of the pixels with value 2, changing its
> value to 3.
>
>
>
> Any ideas?
>
>
>
> Frederico
>
>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
Currículo: http://lattes.cnpq.br/7541377569511492

	[[alternative HTML version deleted]]

