[R] Need ideas on how to show spikes in my data and how to code it in R

Rolf Turner r.turner at auckland.ac.nz
Tue Jun 24 22:04:20 CEST 2008


On 24/06/2008, at 8:10 AM, Daniel Folkinshteyn wrote:

> on 06/23/2008 03:40 PM Thomas Frööjd said the following:

	<SNIP>

>
>> 2.       Scale the data so they can be plotted on the same axis. The
>> reference dataset has around 20 000 observations and my data from the
>> clinic only around 3000 so I have to fix this otherwise the plot of
>> the reference datset will be much bigger in the graph.
>
> if you do a density plot (see ?density in R), it will automatically  
> be scaled. if you want the histogram scaled too, then after  
> calculating the histogram frequencies, multiply them by a ratio of  
> numberofobs for your data, and number of obs for reference data  
> (i.e.: NOBS_yourdata / NOSB_refdata)

	I don't understand this.  Why not just get hist() to plot on the  
density scale,
	thereby making its output commensurate with the output of density()?
	The hist() function will plot on the density scale if you ask it  
to.  Set freq=FALSE
	(or prob=TRUE) in the call to hist.

		cheers,

			Rolf Turner
######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list