Hi, Both vapply() and sapply() support the 'USE.NAMES' argument. According to the man page:
USE.NAMES: logical; if ‘TRUE’ and if ‘X’ is character, use ‘X’ as ‘names’ for the result unless it had names already. But if 'X' has names already and 'USE.NAMES' is FALSE, it's not clear what will happen to the names. Are they going to propagate to the result or not? Unfortunately, vapply() and sapply() give a different answer: > vapply(list(A="a", B=1:2), is.integer, logical(1), USE.NAMES=FALSE) [1] FALSE TRUE > sapply(list(A="a", B=1:2), is.integer, USE.NAMES=FALSE) A B FALSE TRUE Wouldn't it make sense to have vapply() and sapply() treat the 'USE.NAMES' argument consistently? The behavior of vapply() seems to make more sense to me. Note that it's consistent with what mapply() does: > mapply(is.integer, list(A="a", B=1:2), USE.NAMES=FALSE) [1] FALSE TRUE If the behavior of sapply() cannot be changed, at least the man page could clarify what happens when 'USE.NAMES' is FALSE, which is different for each function. 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: hpa...@fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel