[Sciviews-commits] r3 - in pkg/svMisc: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 4 11:01:20 CEST 2008
Author: phgrosjean
Date: 2008-06-04 11:01:20 +0200 (Wed, 04 Jun 2008)
New Revision: 3
Modified:
pkg/svMisc/DESCRIPTION
pkg/svMisc/NEWS
pkg/svMisc/R/objInfo.R
Log:
objInfo() - added object size estimation
Modified: pkg/svMisc/DESCRIPTION
===================================================================
--- pkg/svMisc/DESCRIPTION 2008-06-01 23:58:46 UTC (rev 2)
+++ pkg/svMisc/DESCRIPTION 2008-06-04 09:01:20 UTC (rev 3)
@@ -3,8 +3,8 @@
Imports: utils, methods
Depends: R (>= 2.7.0)
Description: Supporting functions for the GUI API (various utilitary functions)
-Version: 0.9-40
-Date: 2008-06-01
+Version: 0.9-41
+Date: 2008-06-03
Author: Philippe Grosjean
Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
License: GPL 2 or above
Modified: pkg/svMisc/NEWS
===================================================================
--- pkg/svMisc/NEWS 2008-06-01 23:58:46 UTC (rev 2)
+++ pkg/svMisc/NEWS 2008-06-04 09:01:20 UTC (rev 3)
@@ -1,6 +1,10 @@
svMisc News:
============
+Version 0.9-41:
+---------------
+- objInfo() returns also estimated size of objects that are not functions.
+
Version 0.9-40:
---------------
This is the first version distributed on R-forge. It is completely refactored
Modified: pkg/svMisc/R/objInfo.R
===================================================================
--- pkg/svMisc/R/objInfo.R 2008-06-01 23:58:46 UTC (rev 2)
+++ pkg/svMisc/R/objInfo.R 2008-06-04 09:01:20 UTC (rev 3)
@@ -32,6 +32,16 @@
# The info is simply a str() representation of the object
# We need to capture output
Info <- capture.output(str(obj))
+ # Add estimation of size for this object, if it is not a function
+ if (!inherits(obj, "function")) {
+ size <- object.size(obj)
+ if (size > 1024*1024) {
+ size <- paste("Estimated size:", format(size/1024/1024, digits = 3), "Mb")
+ } else if (size > 1024) {
+ size <- paste("Estimated size:", format(size/1024, digits = 3), "kb")
+ } else size <- paste("Estimated size:", format(size, digits = 3), "bytes")
+ Info[length(Info) + 1] <- size
+ }
}
if (!is.null(path)) {
More information about the Sciviews-commits
mailing list