Skip to content
Back to formatted view

Raw Message

Message-ID: <200504190947.51463.deepayan@stat.wisc.edu>
Date: 2005-04-19T14:47:51Z
From: Deepayan Sarkar
Subject: Strange behavior in Lattice when superimposing
In-Reply-To: <05f8aeee21b572df1f3d5f302ba12e3f@fnal.gov>

On Tuesday 19 April 2005 02:19, Adam Lyon wrote:
> Hi,
>
> I am trying to do a simple superimposing of two density plots and am
> seeing strange behavior (I haven't seen this reported elsewhere).
> This little snipit will make it apparent...
>
> a = rnorm(10)
> b = rnorm(100, mean=-2, sd=0.5)
> densityplot( ~ a + b)

I'm not sure if this is explicitly documented anywhere (perhaps not), 
but the variables in the formula have to have the same length. What you 
should really do is 

densityplot(~ c(a, b), groups = rep(c('a', 'b'), c(10, 100))

Your usage should have triggered an error; I'll see if I can make that 
happen.

Deepayan