Re: [R] levelplot blocks size
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.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of jonathan Sent: Monday, December 27, 2010 7:00 PM To: r-help@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@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. __ 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.
Re: [R] levelplot blocks size
Look at the functions cut, findInterval, tapply, and aggregate. Sent from my iPod On Dec 26, 2010, at 4:34 PM, jonathan j...@than.biz wrote: Thanks for your advice, but my data is not decimals, so I don't need to round the values. Instead, what I need to really do is group the values into larger blocks. My data looks sort of like this: xy z 00687 0164 0271 0355 0452 0551 0638 0738 0854 0949 . . . 987 9881 999 9981 999 9991 But what I need to do is make it so that on the graph rather than having tiny little dots for each point (as shown in the bigplot diagram), there are bigger points, so say 0=x10, 0=y10 is one point in the lower left, rather than having 100 points for each x,y value. The same strategy should then be applied to the whole graph. Any ideas how to achieve this? I'm sure this is quite a common thing to do want to with heatmaps?? Thanks, Jonathan -- View this message in context: http://r.789695.n4.nabble.com/levelplot-blocks-size-tp3089972p3164564.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. __ 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.
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@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.
Re: [R] levelplot blocks size
Thanks for your advice, but my data is not decimals, so I don't need to round the values. Instead, what I need to really do is group the values into larger blocks. My data looks sort of like this: xy z 00687 0164 0271 0355 0452 0551 0638 0738 0854 0949 . . . 987 9881 999 9981 999 9991 But what I need to do is make it so that on the graph rather than having tiny little dots for each point (as shown in the bigplot diagram), there are bigger points, so say 0=x10, 0=y10 is one point in the lower left, rather than having 100 points for each x,y value. The same strategy should then be applied to the whole graph. Any ideas how to achieve this? I'm sure this is quite a common thing to do want to with heatmaps?? Thanks, Jonathan -- View this message in context: http://r.789695.n4.nabble.com/levelplot-blocks-size-tp3089972p3164564.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.
Re: [R] levelplot blocks size
Sorry to bump this up again, but I've been continuing to look for a solution to this including a look into stats.bin but I still can't find any solution to do this within R. Any help would be much appreciated! Thanks, Jonathan -- View this message in context: http://r.789695.n4.nabble.com/levelplot-blocks-size-tp3089972p3094752.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.
Re: [R] levelplot blocks size
On 19/12/2010 2:10 PM, jonathan wrote: Sorry to bump this up again, but I've been continuing to look for a solution to this including a look into stats.bin but I still can't find any solution to do this within R. See ?levelplot. The number of bins of x and y is equal to the number of unique x and y values. If you want fewer, just round the values instead of using 1:1000. Duncan Murdoch __ 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.
Re: [R] levelplot blocks size
Duncan, Thanks for the help. I'm new to R, so I'm not sure how to get R to round the values and group them into larger blocks. I have tried the following: xlim=seq(0,2000,100),ylim=seq(0,2000,100) just to see if it would work, but it doesn't... Do you think you might be able to explain how to go about rounding the values? Thanks, Jonathan -- View this message in context: http://r.789695.n4.nabble.com/levelplot-blocks-size-tp3089972p3094797.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.
Re: [R] levelplot blocks size
On 19/12/2010 2:46 PM, jonathan wrote: Duncan, Thanks for the help. I'm new to R, so I'm not sure how to get R to round the values and group them into larger blocks. I have tried the following: xlim=seq(0,2000,100),ylim=seq(0,2000,100) just to see if it would work, but it doesn't... Do you think you might be able to explain how to go about rounding the values? I don't know what your data looks like, so this is hard. levelplot assumes you have triplets (x,y,z), where x and y only take a few values, and it plots the grid of those values using z to set the colour. In your example you read x amd y from a file. So just round them to fewer values, e.g. df$x - round(df$x, -2) # round to -2 decimal places, i.e. to hundreds df$y - round(df$y, -2) levelplot(z ~ x+y, data=df) __ 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.