I am trying to do simple calculations in R when no raw data but grouped data with frequencies is available only. This is the case when I have a large amount of records in a database, say a large SQL table, and then for given reasons GROUP BY and COUNT to aggregate instead of downloading the original table for analysis in R. As I understand, one could say in R that I'm talking about data in a table format.
To give a simple example:
> original=c(1,2,2,3)
> aggregate=table(original)
original
1 2 3
1 2 1
In the case I describe, only data structured like aggregate
would be available as the result of my database query, usually in a data.frame similar to this:
|value|frequency|
|1 |1 |
|2 |2 |
|3 |1 |
What are standard approaches in R to work with this kind of data, particulary when it's the aim to run analysis on value
? E.g., I may want to
- Calculate Mean, Median, Quantiles
- Plot a boxplot which should give the same results as when I would run
boxplot(original)
I feel I'm just missing a basic concept of aggregated data processing in R, cannot imagine it's not something being build in a native way in R.
The only idea I could find googling this was basically an approach to let R create original
based on the frequency information.