Re: [Rd] Documentation of addmargins

2021-12-07 Thread SOEIRO Thomas
Yes, it is!

There is only a small typo (missing punctuation for easier reading)

Sorry for the misunderstanding, it may not be clear enough in my previous mail.

-Message d'origine-
De : GILLIBERT, Andre [mailto:andre.gillib...@chu-rouen.fr] 
Envoyé : mardi 7 décembre 2021 16:59
À : SOEIRO Thomas; R Development List
Objet : RE: Documentation of addmargins

EMAIL EXTERNE - TRAITER AVEC PRÉCAUTION LIENS ET FICHIERS

Thomas SOEIRO wrote:
> Dear list,

> There is a minor typo in addmargins (section Details):

> - If the functions used to form margins are not commutative the result 
> depends on the order in which margins are computed. Annotation of margins is 
> done via naming the FUN list.
> + If the functions used to form margins are not commutative**add ':' or ', 
> i.e.' here** the result depends on the order in which margins are computed. 
> Annotation of margins is done via naming the FUN list.
>
>
> I'm not sure if such minor things really need to be reported when they are 
> noticed... Please let me know if not. Of course this is minor, but imho one 
> of the strengths of R is also its documentation!
>

The documentation looks correct to me.
If the function FUN is not commutative (i.e. the result depends on the order of 
the vector passed to it), then the result of addmargins() will depend on the 
order of the 'margin' argument to the addmargins() function.

For instance:
mat <- rbind(c(1,10),c(100,1000))
fun <- function(x) {x[1]-x[2]-x[1]*x[2]} # non-commutative function a <- 
addmargins(mat ,margin=c(1,2), FUN=fun) b <- addmargins(mat ,margin=c(2,1), 
FUN=fun)

a and b are different, because the fun function is not commutative.

--
Sincerely
André GILLIBERT
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Documentation of addmargins

2021-12-07 Thread GILLIBERT, Andre

Thomas SOEIRO wrote:
> Dear list,

> There is a minor typo in addmargins (section Details):

> - If the functions used to form margins are not commutative the result 
> depends on the order in which margins are computed. Annotation of margins is 
> done via naming the FUN list.
> + If the functions used to form margins are not commutative**add ':' or ', 
> i.e.' here** the result depends on the order in which margins are computed. 
> Annotation of margins is done via naming the FUN list.
>
>
> I'm not sure if such minor things really need to be reported when they are 
> noticed... Please let me know if not. Of course this is minor, but imho one 
> of the strengths of R is also its documentation!
>

The documentation looks correct to me.
If the function FUN is not commutative (i.e. the result depends on the order of 
the vector passed to it), then the result of addmargins() will depend on the 
order of the 'margin' argument to the addmargins() function.

For instance:
mat <- rbind(c(1,10),c(100,1000))
fun <- function(x) {x[1]-x[2]-x[1]*x[2]} # non-commutative function
a <- addmargins(mat ,margin=c(1,2), FUN=fun)
b <- addmargins(mat ,margin=c(2,1), FUN=fun)

a and b are different, because the fun function is not commutative.

-- 
Sincerely
André GILLIBERT
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Documentation of addmargins

2021-12-07 Thread SOEIRO Thomas
Dear list,

There is a minor typo in addmargins (section Details):

- If the functions used to form margins are not commutative the result depends 
on the order in which margins are computed. Annotation of margins is done via 
naming the FUN list.
+ If the functions used to form margins are not commutative**add ':' or ', 
i.e.' here** the result depends on the order in which margins are computed. 
Annotation of margins is done via naming the FUN list.


I'm not sure if such minor things really need to be reported when they are 
noticed... Please let me know if not. Of course this is minor, but imho one of 
the strengths of R is also its documentation!

Best,

Thomas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel