I have point series in a data.frame with duplication. I would like to plot them using level plot, and use as a Z frequency of x, y (in example how many times for x = 1 there was y = 2). How can I do this? Well it is easy for me to explain myself with SQL syntax:
SELECT x, y, count(*) from data_frame GROUP BY x, y
🙂
These kinds of summarizing a data frame by groups defined by variables is very common in R. Many of the *pply functions would work. The standard response these days is to use
ddplyfrom theplyrpackage:In general, you should really learn the
plyrpackage, along with all the base*pplyfunctions.But if you’re more comfortable with SQL, you might consider looking at the
sqldfpackage, which lets you do a lot of these kinds of manipulations of data frames directly with SQL.