[R] levelplot blocks size

Duncan Murdoch murdoch.duncan at gmail.com
Sun Dec 19 22:10:53 CET 2010


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)



More information about the R-help mailing list