Pages, Herve
2020-Sep-30 15:59 UTC
[Rd] inaccurate description of 'init' argument in ?Reduce
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 at fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319