Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
331 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
...