[R] does qplot works with Sweave?

Felipe Carrillo mazatlanmexico at yahoo.com
Tue Oct 28 21:43:37 CET 2008

Hi Hadley:
I'm practicing writing a document using MikTex but can't make qplot to execute. It works when using 'plot' though. Is this a normal behaviour?

 \title{ggplot2 example}


\section*{Examples of using ggplot2}
 The goal is to be able to import ggplot2 graphics into the annual report.
Hadley Wickham has done a great job by creating this free R package.
Let's get some data into R from one the built-in packages:
 We'll work with the diamonds data. This dataset is really large, it accounts for
over 50.000 records. We will demostrate  how to create nice and colorful graphics
as well as creating some nice tabular tables with  horizontal and vertical lines.

dsmall <- diamonds[sample(nrow(diamonds),1000),]
qplot(carat,price,data=dsmall,colour = color)  #THIS CODE DOESN'T WORK

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA

More information about the R-help mailing list