r get value only from quantile() function

rstruck picture rstruck · Feb 10, 2015 · Viewed 41.7k times · Source

I'm sorry for what may be a silly question. When I do:

> quantile(df$column, .75) #get 3rd quartile

I get something like

75% 
1234.5 

Is there a way to just get the value (1234.5) without the descriptive "75%" string? Thank you very much.

Answer

Jilber Urbina picture Jilber Urbina · Feb 10, 2015

You can also use unname

> result <- quantile(c(1,2,3,4),0.75)
> unname(result)
[1] 3.25

Also you can subset by using [[

> result[[1]]
[1] 3.25