[R] levelplot blocks size

Greg Snow Greg.Snow at imail.org
Tue Dec 28 21:31:32 CET 2010


Here is a basic example: 

tmp.df <- expand.grid( x= 1:100, y=1:100 )
tmp.df$z <- with(tmp.df, x+2*y)

library(lattice)
levelplot( z ~ x + y, data=tmp.df )

tx2 <- with(tmp.df, cut(x, seq(0.5, 100.5, 10) ) )
ty2 <- with(tmp.df, cut(y, seq(0.5, 100.5, 20) ) )

tmp.df2 <- aggregate(tmp.df, list( tx2, ty2 ), mean )

levelplot( z ~ x + y, data=tmp.df2 )


Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of jonathan
> Sent: Monday, December 27, 2010 7:00 PM
> To: r-help at r-project.org
> Subject: Re: [R] levelplot blocks size
> 
> 
> Thanks for your help.
> 
> Might you be able to explain in a little more detail how to use those
> functions to solve this specific problem?
> 
> I'm happy to put in the work myself and have looked up those functions
> but
> am new to R and still a little unsure about how I would go about using
> those
> functions to solve my problem.
> 
> Thanks,
> 
> Jonathan
> --
> View this message in context: http://r.789695.n4.nabble.com/levelplot-
> blocks-size-tp3089972p3165638.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list