emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* calculating quartils, tercils (or percentiles) Using R?
@ 2022-05-22  6:40 Uwe Brauer
  2022-05-22 10:31 ` Jeremie Juste
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2022-05-22  6:40 UTC (permalink / raw)
  To: emacs-orgmode


Hi

I can use R to calculate quartils 
as in 
#+begin_src 

#+tblname: TC
| Data |
|------|
|    5 |
|   10 |
|   12 |
|   15 |
|   20 |
|   24 |
|   27 |
|   30 |
|   35 |




#+begin_src R :colnames t :var t1=TC 
 summary(t1)
#+end_src

#+RESULTS:
| Data          |
|---------------|
| Min.   : 5.00 |
| 1st Qu.:12.00 |
| Median :20.00 |
| Mean   :19.78 |
| 3rd Qu.:27.00 |
| Max.   :35.00 |
#+end_src

but I can't not find a way to calculate other percentiles, like terciles or so.

Does anybody know about this, or a org-function doing it?

regards

Uwe Brauer


-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: calculating quartils, tercils (or percentiles) Using R?
  2022-05-22  6:40 calculating quartils, tercils (or percentiles) Using R? Uwe Brauer
@ 2022-05-22 10:31 ` Jeremie Juste
  2022-05-22 11:53   ` Uwe Brauer
  2022-07-13 11:59   ` [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?) Uwe Brauer
  0 siblings, 2 replies; 6+ messages in thread
From: Jeremie Juste @ 2022-05-22 10:31 UTC (permalink / raw)
  To: emacs-orgmode


Hello Uwe,

> On Sunday, 22 May 2022 at 08:40, Uwe Brauer wrote:

> but I can't not find a way to calculate other percentiles, like terciles or so.
> Does anybody know about this, or a org-function doing it?


I would recommend checking the R documentation. 
 #+begin_src R :colnames t :var t1=TC :results output
  ?quantile
 #+end_src

 #+tblname: TC
 | Data |
 |------|
 |    5 |
 |   10 |
 |   12 |
 |   15 |
 |   20 |
 |   24 |
 |   27 |
 |   30 |
 |   35 |

Consider also the R mailing list r-help@r-project.org. The community is
quite active. 

I believe that you might be looking for the following.

 #+begin_src R :colnames t :var t1=TC 
  quantile(t1$Data,c(1/3,2/3,1))
 #+end_src

 #+RESULTS:
 |  x |
 |----|
 | 14 |
 | 25 |
 | 35 |


HTH,

Jeremie 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: calculating quartils, tercils (or percentiles) Using R?
  2022-05-22 10:31 ` Jeremie Juste
@ 2022-05-22 11:53   ` Uwe Brauer
  2022-07-13 11:59   ` [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?) Uwe Brauer
  1 sibling, 0 replies; 6+ messages in thread
From: Uwe Brauer @ 2022-05-22 11:53 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Hello Jermie


> Hello Uwe,




> I would recommend checking the R documentation. 

Believe me, I tried (well I mostly googled, and I failed, I understand
now why, my column name was not consistent, with the call in src block grrr


> I believe that you might be looking for the following.

>  #+begin_src R :colnames t :var t1=TC 
>   quantile(t1$Data,c(1/3,2/3,1))
>  #+end_src

>  #+RESULTS:
>  |  x |
>  |----|
>  | 14 |
>  | 25 |
>  | 35 |

Definitely! Works like charm! 😀

Thanks so much!

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?)
  2022-05-22 10:31 ` Jeremie Juste
  2022-05-22 11:53   ` Uwe Brauer
@ 2022-07-13 11:59   ` Uwe Brauer
  2022-07-14  6:14     ` Rudolf Adamkovič
  1 sibling, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2022-07-13 11:59 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

>>> "JJ" == Jeremie Juste <jeremiejuste@gmail.com> writes:

> Hello Uwe,

>> On Sunday, 22 May 2022 at 08:40, Uwe Brauer wrote:

>> but I can't not find a way to calculate other percentiles, like
>> terciles or so. Does anybody know about this, or a org-function doing
>> it?


> I would recommend checking the R documentation. 

>  #+begin_src R :colnames t :var t1=TC :results output
>   ?quantile
>  #+end_src

>  #+tblname: TC
>  | Data |

>  |------|
>  |    5 |
>  |   10 |
>  |   12 |
>  |   15 |
>  |   20 |
>  |   24 |
>  |   27 |
>  |   30 |
>  |   35 |

> Consider also the R mailing list r-help@r-project.org. The community is
> quite active. 

> I believe that you might be looking for the following.

>  #+begin_src R :colnames t :var t1=TC 
>   quantile(t1$Data,c(1/3,2/3,1))
>  #+end_src

As I said that works nicely, however it turns out that I need to round
the result in a specific way, always round toward positive infinity, 
the matlab command `ceil' for example does this, I can't find anything
similar in the documentation. You recommend to use the R mailing list,
which I will do, but maybe you know it by heart?

Thanks and regards

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?)
  2022-07-13 11:59   ` [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?) Uwe Brauer
@ 2022-07-14  6:14     ` Rudolf Adamkovič
  2022-07-14  6:19       ` [rounding (ceil in matlab)] Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Rudolf Adamkovič @ 2022-07-14  6:14 UTC (permalink / raw)
  To: Uwe Brauer, emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> […] the matlab command `ceil' for example does this, I can't find
> anything similar in the documentation.

How about the 'ceiling' function?  See '?ceiling'.  For example:

ceiling(quantile(c(1, 2, 3), c(1 / 3, 2 / 3, 1)))

Rudy
-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [rounding (ceil in matlab)]
  2022-07-14  6:14     ` Rudolf Adamkovič
@ 2022-07-14  6:19       ` Uwe Brauer
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Brauer @ 2022-07-14  6:19 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

>>> "RA" == Rudolf Adamkovič <salutis@me.com> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> […] the matlab command `ceil' for example does this, I can't find
>> anything similar in the documentation.

> How about the 'ceiling' function?  See '?ceiling'.  For example:

> ceiling(quantile(c(1, 2, 3), c(1 / 3, 2 / 3, 1)))

Thanks! That solved the problem

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-14  6:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22  6:40 calculating quartils, tercils (or percentiles) Using R? Uwe Brauer
2022-05-22 10:31 ` Jeremie Juste
2022-05-22 11:53   ` Uwe Brauer
2022-07-13 11:59   ` [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?) Uwe Brauer
2022-07-14  6:14     ` Rudolf Adamkovič
2022-07-14  6:19       ` [rounding (ceil in matlab)] Uwe Brauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).