Have a look at the knitr package. http://yihui.name/knitr/demo/minimal/

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey


-----Oorspronkelijk bericht-----
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens 
Pavneet Arora
Verzonden: woensdag 23 april 2014 11:14
Aan: Jeff Newmiller
CC: r-help@r-project.org
Onderwerp: Re: [R] Fw: Save multiple plots as pdf or jpeg

Sorry I should have been more clearer. Let me repharse.

At the moment I have a loop that plots a histogram of the variable, along with 
rug and super-imposed normal curve over it. It does that for a lot of variables 
in the dataset and then compiles them into a pdf. Whereby each page on the pdf 
corresponds to the histogram of 1 variable.

However, it takes ages to load and takes up a lot of memory. So I was wondering 
if there is a way that before it gets compiled into a pdf, if I can convert my 
graphs into png or bitmaps images and then compile them into pdf?

This is my code so far:

pdf(file="C:/#temp/Histo and2.pdf") ##- Saves all plots in the same pdf file
for(k in 1:ncol(nums2)){    hist(nums2[,k],freq=F,col="lightblue1",
#density=20   ##- Density -> Gives shaded bars
 main=names(nums2)[k],col.main="blue",cex.main=0.8,font=2,
                                 xlab=names(nums2)[k])  ##- Font=2 => bold

 #rug(jitter(nums2[,k]),side=1,col="antiquewhite3")

 lines(density(nums2[,k],na.rm=T),col="navy",lwd=2)          ##- Density
Function of data

 curve(dnorm(x,mean=mean(nums2[,k],na.rm=T),sd=sd(nums2[,k],na.rm=T)),
                                  col="brown",lwd=3,add=T)

                            #  readline(prompt="Press [enter] to
continue")
}
dev.off()
Hope this is much clearer?




From:   Jeff Newmiller <jdnew...@dcn.davis.ca.us>
To:     Pavneet Arora/UK/RoyalSun@RoyalSun, r-help@r-project.org
Date:   22/04/2014 16:09
Subject:        Re: [R] Fw: Save multiple plots as pdf or jpeg



Sounds like you are getting what you want... except that you used the word
"but". If you are not getting what you want, then what is it that you do
want? In particular, how do you intend to review or use many plots
generated at once if not in a PDF file?
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go
Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#. rocks...1k
---------------------------------------------------------------------------

Sent from my phone. Please excuse my brevity.

On April 22, 2014 6:59:55 AM PDT, starter <pavneet.ar...@uk.rsagroup.com>
wrote:
>That is what I was trying to achieve; i.e. plot all my graphs using a
>loop
>function. But somewhere in the loop it converts each graph into png or
>bitmap image and then compiles all these png or bitmap images in a pdf
>file.
>So each page in a pdf file is a bitmap or png picture of my graph.
>
>Does that make any sense?
>
>
>
>--
>View this message in context:
>
http://r.789695.n4.nabble.com/Fw-Save-multiple-plots-as-pdf-or-jpeg-tp4688801p4689256.html

>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>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.





______________________________________________________________________________________________

The following message has been automatically added to comply with the RSA
Group IT Security requirements:

This email arrived via the internet, over a secure Opportunistic TLS
encryption connection.
This means the email was sent using encryption but the senders domain has
not been verified for its authenticity.
As such you still need to be cautious about its origin and content.
Replies which contain sensitive information or legal/contractual
obligations are particularly vulnerable.
In these cases you should not reply unless you are authorised to do so.

If you have any questions, please speak to the Service Centre on x7979.
______________________________________________________________________________________________


***********************************************************************************************************************************************************************************************************************
MORE TH>N is a trading style of Royal & Sun Alliance Insurance plc (No. 93792). 
Registered in England and Wales at St. Mark’s Court, Chart Way, Horsham, West 
Sussex, RH12 1XL.

Authorised by the Prudential Regulation Authority and regulated by the 
Financial Conduct Authority and the Prudential Regulation Authority.
************************************************************************************************************************************************************************************************************************

        [[alternative HTML version deleted]]

* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the 
writer and may not be regarded as stating an official position of INBO, as long 
as the message is not confirmed by a duly signed document.
______________________________________________
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