A quick one for you, dearest R gurus:
I'm doing an assignment and I've been asked, in this exercise, to get basic statistics out of the infert
dataset (it's in-built), and specifically one of its columns, infert$age
.
For anyone not familiar with the dataset:
> table_ages # Which is just subset(infert, select=c("age"));
age
1 26
2 42
3 39
4 34
5 35
6 36
7 23
8 32
9 21
10 28
11 29
...
246 35
247 29
248 23
I've had to find median values of the column, variance, skewness, standard deviation which were all okay, until I was asked to find the column "percentiles".
I haven't been able to find anything so far, and maybe I've translated it incorrectly from greek, the language of the assignment. It was "ποσοστημόρια", Google Translate pointed the English term to be "percentiles".
Any tutorials or ideas on finding those "percentiles" of infert$age
?
If you order a vector x
, and find the values that is half way through the vector, you just found a median, or 50th percentile. Same logic applies for any percentage. Here are two examples.
x <- rnorm(100)
quantile(x, probs = c(0, 0.25, 0.5, 0.75, 1)) # quartile
quantile(x, probs = seq(0, 1, by= 0.1)) # decile