Читать книгу Probability with R - Jane M. Horgan - Страница 44

2.3 Overall Summary Statistics

Оглавление

A quicker way of summarizing the data is to use the summary function.

summary(downtime)

returns

Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00 16.00 25.00 25.04 31.50 51.00

which are the minimum the first quartile, the median, the mean, the third quartile, and the maximum, respectively.

For , we might write

summary(arch1)

which gives

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 3.00 46.75 68.50 63.57 83.25 100.00 3.00

An entire data frame may be summarized by using the summary command. Let us do this in the data frame . First, it is wise to make a declaration about the categorical variable gender.

gender <- factor(gender)

designates the variable gender as a factor, and ensures that it is treated as such in the summary function.

summary(results) gender arch1 prog1 arch2 prog2 f: 19 Min. : 3.00 Min. :12.00 Min. : 6.00 Min. : 5.00 m:100 1st Qu.: 46.75 1st Qu.:40.00 1st Qu.:40.00 1st Qu.:30.00 Median : 68.50 Median :64.00 Median :48.00 Median :57.00 Mean : 63.57 Mean :59.02 Mean :51.97 Mean :53.78 3rd Qu.: 83.25 3rd Qu.:78.00 3rd Qu.:61.00 3rd Qu.:76.50 Max. :100.00 Max. :98.00 Max. :98.00 Max. :97.00 NA's : 3.00 NA's : 2.00 NA's : 4.00 NA's : 8.00

Notice how the display for gender is different than that for the other variables; we are simply given the frequency for each gender.

Probability with R

Подняться наверх