Hello

My question might sound awkward, but I am looking for a way to somehow
convert a plot in R into a base64 string.

Here's an idea, but it is not at all satisfying.

1. write the plot to the harddisk:
---------------------------
png("toto.png")
plot(c(1,2,3))
dev.off()
---------------------------

2. somehow reload that file from the disk and transform it into a base64
string:
---------------------------
bin<-readBin(file("toto.png","rb"), raw(), n=1000,endian = "little")
...
---------------------------

Using the disk to perform this is not elegant, I don't know what value
to put for n, and I don't like the general idea.

Does anyone have a better suggestion? I have already searched on the
internet and in the mailing list, and I just found something on a
caTools package containing a base64encode & base64decode function.

Thanx for any ideas ...

Patrick

______________________________________________
R-help@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.

Reply via email to