[Rd] oddity in transform

2018-07-23 Thread Gabor Grothendieck
Note the inconsistency in the names in these two examples.  X.Time in
the first case and Time.1 in the second case.

  > transform(BOD, X = BOD[1:2] * seq(6))
Time demand X.Time X.demand
  118.3  1  8.3
  22   10.3  4 20.6
  33   19.0  9 57.0
  44   16.0 16 64.0
  55   15.6 25 78.0
  67   19.8 42118.8

  > transform(BOD, X = BOD[1] * seq(6))
Time demand Time.1
  118.3  1
  22   10.3  4
  33   19.0  9
  44   16.0 16
  55   15.6 25
  67   19.8 42

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


[Rd] Suggestion for updating `p.adjust` with new method (BKY 2006)

2018-07-23 Thread Xiaoqing Claire Rong-Mullins
Dear R contributors,

I suggest adding a new method to `p.adjust` ("Adjust P-values for Multiple
Comparisons",
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/p.adjust.html).

This new method is published in Benjamini, Krieger, Yekutieli 2016 Adaptive
linear step-up procedures that control the false discovery rate
(Biometrika). https://doi.org/10.1093/biomet/93.3.491

This paper described multiple methods for adjusting p-values, where the "TST"
method (Definition 6) performed the best when test statistics are
positively correlated, per my interpretation. This method can be labeled as
"BKY", for the three authors Benjamini, Krieger, Yekutieli.

I apologize if this is a duplication.


Best,
Claire

Xiaoqing Claire Rong-Mullins
Bioinformatic Specialist
Division of Biostatistics
College of Public Health
The Ohio State University

[[alternative HTML version deleted]]

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


[Rd] Is NULL a vector?

2018-07-23 Thread Hadley Wickham
Hi all,

Would you generally consider NULL to be a vector? Base R functions are
a little inconsistent:

## In favour

``` r
identical(as.vector(NULL), NULL)
#> [1] TRUE

identical(as(NULL, "vector"), NULL)
#> [1] TRUE

# supports key vector vector generics
length(NULL)
#> [1] 0
NULL[c(3, 4, 5)]
#> NULL
NULL[[1]]
#> NULL
```

## Against

``` r
is.vector(NULL)
#> [1] FALSE

is(NULL, "vector")
#> [1] FALSE
```

## Abstentions

``` r
is.atomic(NULL)
#> [1] TRUE
# documentation states "returns NULL if x is of an atomic type (or NULL)"
# is "or" exclusive or inclusive?
```

Hadley

-- 
http://hadley.nz

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


Re: [Rd] Is NULL a vector?

2018-07-23 Thread Duncan Murdoch

On 23/07/2018 3:03 PM, Hadley Wickham wrote:

Hi all,

Would you generally consider NULL to be a vector? 


According to the language definition (in the doc directory), it is not: 
"Vectors can be thought of as contiguous cells containing data. Cells 
are accessed through indexing operations such as x[5]. More details are 
given in Indexing.


R has six basic (‘atomic’) vector types: logical, integer, real, 
complex, string (or character) and raw. The modes and storage modes for 
the different vector types are listed in the following table."


and later

"There is a special object called NULL. It is used whenever there is a 
need to indicate or specify that an object is absent. It should not be 
confused with a vector or list of zero length."


Duncan Murdoch

Base R functions are

a little inconsistent:

## In favour

``` r
identical(as.vector(NULL), NULL)
#> [1] TRUE

identical(as(NULL, "vector"), NULL)
#> [1] TRUE

# supports key vector vector generics
length(NULL)
#> [1] 0
NULL[c(3, 4, 5)]
#> NULL
NULL[[1]]
#> NULL
```

## Against

``` r
is.vector(NULL)
#> [1] FALSE

is(NULL, "vector")
#> [1] FALSE
```

## Abstentions

``` r
is.atomic(NULL)
#> [1] TRUE
# documentation states "returns NULL if x is of an atomic type (or NULL)"
# is "or" exclusive or inclusive?
```

Hadley



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


Re: [Rd] Is NULL a vector?

2018-07-23 Thread Hadley Wickham
On Mon, Jul 23, 2018 at 2:17 PM, Duncan Murdoch
 wrote:
> On 23/07/2018 3:03 PM, Hadley Wickham wrote:
>>
>> Hi all,
>>
>> Would you generally consider NULL to be a vector?
>
>
> According to the language definition (in the doc directory), it is not:
> "Vectors can be thought of as contiguous cells containing data. Cells are
> accessed through indexing operations such as x[5]. More details are given in
> Indexing.
>
> R has six basic (‘atomic’) vector types: logical, integer, real, complex,
> string (or character) and raw. The modes and storage modes for the different
> vector types are listed in the following table."
>
> and later
>
> "There is a special object called NULL. It is used whenever there is a need
> to indicate or specify that an object is absent. It should not be confused
> with a vector or list of zero length."

Perfect, thanks!

Also available online at
https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Vector-objects

Hadley

-- 
http://hadley.nz

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