# [R] Quantile question

Henrik Bengtsson hb at stat.berkeley.edu
Thu Oct 7 09:13:56 CEST 2010

```Alternatively,

see rowQuantiles() in the matrixStats package.

/Henrik

On Wed, Oct 6, 2010 at 10:34 PM, Joshua Wiley <jwiley.psych at gmail.com> wrote:
> Hi,
>
> This should do it, for details, see ?apply
>
> a <- matrix(rnorm(10000),100,100)
> t(apply(a, 1, quantile, probs = c(.3, .5)))
>
> Basically you apply() the quantile function to each row (the 1, 2
> would indicate columns) in the object 'a'.
>
> HTH,
>
> Josh
>
> On Wed, Oct 6, 2010 at 10:20 PM, Takos <zyoungs at gmail.com> wrote:
>>
>> Simple Question
>>
>> I have 100x100 matrix and I want to calculte each row's 30,50% quantile
>>
>> ex)
>>
>> a=matrix(rnorm(10000),100,100)
>> quantile(a[1,],c(0.3,0.5))
>> quantile(a[2,],c(0.3,0.5))
>> .
>> .
>> .
>> .
>>
>>
>> I want get results at once.
>>
>> so I try quantile(a[1:100,],c(0.3,0.5)) but I can get what I exactly want.
>>
>> How can I calculte that?
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Quantile-question-tp2966195p2966195.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help