Re: [R] Can data.frame be saved as image?

2012-12-21 Thread arun
Hi Katherine,

You could try this:
library(plotrix)
png("katherine.png")
 plot(0:3,0:3,xlab="",ylab="",type="n",axes=FALSE)
 addtable2plot(1,1,output1,cex=2)
 dev.off()


A.K.




- Original Message -
From: Katherine Gobin 
To: r-help@r-project.org
Cc: 
Sent: Friday, December 21, 2012 8:59 AM
Subject: [R] Can data.frame be saved as image?

Dear R forum

I have one stupid question, but I have no other solution to it in sight?

Suppose some R process creates graphs etc alongwith main output as data.frame 
e.g 

output1 = data.frame(bands = c("A", "B", "C"), results = c(74, 108,  65))

I normally save this output as some csv file.

But I need to save this output as some image (I understand this is weird, but I 
need to find out some way to do so) e.g. for graph, I use 'png' as

png("histogram.png", width=480,height=480)

.

..

dev.off()

Please advise.

Regards

Katherine


    [[alternative HTML version deleted]]


__
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.
<>__
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.


Re: [R] Can data.frame be saved as image?

2012-12-21 Thread Katherine Gobin
Dear Sir,

Thanks a lot for your suggestion. In the meantime I came across 

http://stackoverflow.com/questions/10587621/how-to-print-to-paper-a-nicely-formatted-data-frame

and got to know about the package "gridExtra"

So I used following code 

png(filename = "output1.png", width=480,height=480)
grid.table(output1)

dev.off()

And that solved it. 

Thanks again Sir for suggesting other two  pacakages 'lattice' or 'ggplot2' as 
definitely I will like to decipher these two.

I understand before posting the mail to the forum, I should have tried old 
mails etc, but I was bit desperate to know the solution and somehow I felt it's 
a stupid thing to do so. I will remember it next time.

Regards

Katherine



--- On Fri, 21/12/12, jim holtman  wrote:

From: jim holtman 
Subject: Re: [R] Can data.frame be saved as image?
To: "Katherine Gobin" 
Cc: r-help@r-project.org
Date: Friday, 21 December, 2012, 2:39 PM

do you want to save the dataframe used in the plot and then the plot
itself?  If so consider using 'lattice' or 'ggplot2' which create an
object for "print" and this would allow you to use 'save' to save both
objects in a file.

If you want to generate the 'png' file, the you would have to 'save'
the dataframe and then 'zip' the .RData and png file into a new file.

So what is it that you intend to do with the data that is saved in the
common file?

On Fri, Dec 21, 2012 at 8:59 AM, Katherine Gobin
 wrote:
> Dear R forum
>
> I have one stupid question, but I have no other solution to it in sight?
>
> Suppose some R process creates graphs etc alongwith main output as data.frame 
> e.g
>
> output1 = data.frame(bands = c("A", "B", "C"), results = c(74, 108,  65))
>
> I normally save this output as some csv file.
>
> But I need to save this output as some image (I understand this is weird, but 
> I need to find out some way to do so) e.g. for graph, I use 'png' as
>
> png("histogram.png", width=480,height=480)
>
> .
>
> ..
>
> dev.off()
>
> Please advise.
>
> Regards
>
> Katherine
>
>
>         [[alternative HTML version deleted]]
>
>
> __
> 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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

[[alternative HTML version deleted]]

__
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.


Re: [R] Can data.frame be saved as image?

2012-12-21 Thread jim holtman
do you want to save the dataframe used in the plot and then the plot
itself?  If so consider using 'lattice' or 'ggplot2' which create an
object for "print" and this would allow you to use 'save' to save both
objects in a file.

If you want to generate the 'png' file, the you would have to 'save'
the dataframe and then 'zip' the .RData and png file into a new file.

So what is it that you intend to do with the data that is saved in the
common file?

On Fri, Dec 21, 2012 at 8:59 AM, Katherine Gobin
 wrote:
> Dear R forum
>
> I have one stupid question, but I have no other solution to it in sight?
>
> Suppose some R process creates graphs etc alongwith main output as data.frame 
> e.g
>
> output1 = data.frame(bands = c("A", "B", "C"), results = c(74, 108,  65))
>
> I normally save this output as some csv file.
>
> But I need to save this output as some image (I understand this is weird, but 
> I need to find out some way to do so) e.g. for graph, I use 'png' as
>
> png("histogram.png", width=480,height=480)
>
> .
>
> ..
>
> dev.off()
>
> Please advise.
>
> Regards
>
> Katherine
>
>
> [[alternative HTML version deleted]]
>
>
> __
> 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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

__
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.