From benjamin.hofner at fau.de  Thu Nov 19 19:06:45 2015
From: benjamin.hofner at fau.de (Benjamin Hofner)
Date: Thu, 19 Nov 2015 19:06:45 +0100
Subject: [Rd] format.pval
Message-ID: <564E0FB5.6060703@fau.de>

Today I stumbled upon a very strange behaviour of format.pval. If all p 
values are below the threshold eps one gets

format.pval(c(0.0002, 0.0004), eps = 0.001)
## [1] "< 0.001" "< 0.001"
format.pval(0.0004, eps = 0.001)
## [1] "< 0.001"

i.e., "< [eps]" as described in the manual of format.eps.


Yet, if one ore more are above (and one or more below) one gets

format.pval(c(1, 0.0004), eps = 0.001)
## [1] "1" "<0.001"

i.e., "<[eps]", without the blank after <.


One can also change this by setting digits = 1

format.pval(c(0.0002, 0.0004), eps = 0.001, digits = 1)
## [1] "<0.001" "<0.001"

 From the code I've learned that

sep <- if (digits == 1L && nc <= 6L) "" else " "

if any p values are above eps (nc = max(nchar(pv)) and

sep <- if (digits == 1) "" else " "

if all p values are  smaller than eps.

(Why) is this behaviour intended? I do not see any reason for the 
different outputs (nor for the arbitrary nc threshold). Yet, if it is 
intended it should be documented.

Best,
Benjamin



[Rd] format.pval
Benjamin Hofner