[Rd] inaccurate description of 'init' argument in ?Reduce

Pages, Herve hp@ge@ @end|ng |rom |redhutch@org
Wed Sep 30 17:59:24 CEST 2020


Hello list,

In ?Reduce:

   init: an R object of the same kind as the elements of ‘x’.

Seems like "the same kind" is an unnecessary and artificial restriction. 
Furthermore, there is no notion of "same kind" for heterogeneous lists:

   x <-  list(letters, c(TRUE, FALSE))

   Reduce(function(init, xx) {init + length(xx)}, x, init=100)
   # [1] 128

Thanks,
H.

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages using fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319


More information about the R-devel mailing list