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

Gildas Mazo gildas.mazo at curie.fr
Wed Apr 28 20:20:43 CEST 2010


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



More information about the R-help mailing list