Description Usage Arguments Note Author(s) See Also Examples
This is essentially weighted.mean
for a
data.frame
representing grouped data.
1 | TDAGroupMean(inDF)
|
inDF |
The input
|
It is also possible to call this function directly on the
stored output of the TDAFreq
function,
though it would make more sense to calculate the simple
arithmetic mean
from the raw data if that
is available
Ananda Mahto
weighted.mean
, mean
,
TDAFreq
, TDAGroupMedian
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Your input data.frame should look like this
MyGroupedDF <- data.frame(
ClassLow = c(0, 50, 100, 150, 200, 250, 300, 350, 400, 450),
ClassHigh = c(50, 100, 150, 200, 250, 300, 350, 400, 450, 500),
Freq = c(78, 123, 187, 82, 51, 47, 13, 9, 6, 4))
MyGroupedDF
TDAGroupMean(MyGroupedDF)
set.seed(1)
x <- sample(300, 100, replace = TRUE)
mean(x)
temp <- TDAFreq(x, 10)
## Now, imagine that we have deleted x, but still want the mean
## Not exactly the same, but very close...
TDAGroupMean(temp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.