[R] function which saves an image of a dgtMatrix as png

Gildas Mazo gildas.mazo at curie.fr
Thu Apr 29 09:57:02 CEST 2010


Thanks so much



Douglas Bates a écrit :
> image applied to a sparseMatrix object uses lattice functions to
> create the image.  As described in R FAQ 7.22 you must use
>
> print(image(x))
>
> or
>
> show(image(x))
>
> or even
>
> plot(image(x))
>
> when a lattice function is called from within another function.
> On Wed, Apr 28, 2010 at 1:20 PM, Gildas Mazo <gildas.mazo at curie.fr> wrote:
>   
>> Hi,
>>
>> I'm getting crazy:
>>
>> This does work:
>>
>> library(Matrix)
>> a1<-b1<-c(1,2)
>> c1<-rnorm(2)
>> aDgt<-spMatrix(ncol=3,nrow=3,i=a1,j=b1,x=c1)
>> png("myImage.png")
>> image(aDgt)
>> dev.off()
>>
>> But this doesn't !!!
>>
>> f<-function(x){
>> png("myImage.png")
>> image(x)
>> dev.off()
>> }
>> f(aDgt)
>>
>> My image is saved as a text file and contains nothing at all !!!
>> Thanks in advance,
>>
>> Gildas Mazo
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>     
>
>
>



More information about the R-help mailing list