[Rd] [PATCH] show vector length in summary()

Sam Steingold sds at gnu.org
Tue Sep 10 16:32:45 CEST 2013


(summary.default): show the vector length in addition to quantiles


diff -u -i -p -F '^(def' -b -w -B /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old /home/sds/src/R-3.0.1/src/library/base/R/summary.R
--- /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old	2013-03-05 18:02:33.000000000 -0500
+++ /home/sds/src/R-3.0.1/src/library/base/R/summary.R	2013-09-10 10:19:02.682946339 -0400
@@ -39,6 +39,7 @@ summary.default <-
 	qq <- stats::quantile(object)
 	qq <- signif(c(qq[1L:3L], mean(object), qq[4L:5L]), digits)
 	names(qq) <- c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max.")
+  qq <- c(qq,"Length" = length(object))
 	if(any(nas))
 	    c(qq, "NA's" = sum(nas))
 	else qq

Diff finished.  Tue Sep 10 10:19:40 2013


-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000
http://www.childpsy.net/ http://dhimmi.com http://openvotingconsortium.org
http://thereligionofpeace.com http://www.memritv.org http://camera.org
Between grand theft and a legal fee, there only stands a law degree.



More information about the R-devel mailing list