[Pomp-commits] r723 - in pkg/pompExamples: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 14 23:36:47 CEST 2012


Author: kingaa
Date: 2012-05-14 23:36:46 +0200 (Mon, 14 May 2012)
New Revision: 723

Added:
   pkg/pompExamples/R/
   pkg/pompExamples/R/version.R
Modified:
   pkg/pompExamples/DESCRIPTION
Log:
- add 'version'


Modified: pkg/pompExamples/DESCRIPTION
===================================================================
--- pkg/pompExamples/DESCRIPTION	2012-05-14 21:21:18 UTC (rev 722)
+++ pkg/pompExamples/DESCRIPTION	2012-05-14 21:36:46 UTC (rev 723)
@@ -11,3 +11,4 @@
 LazyLoad: true
 LazyData: false
 BuildVignettes: no
+Collate: version.R

Added: pkg/pompExamples/R/version.R
===================================================================
--- pkg/pompExamples/R/version.R	                        (rev 0)
+++ pkg/pompExamples/R/version.R	2012-05-14 21:36:46 UTC (rev 723)
@@ -0,0 +1,15 @@
+version <- function (at.least = NULL) {
+  version <- library(help=pompExamples)$info[[1]]
+  version <- strsplit(version[pmatch("Version",version)]," ")[[1]]
+  version <- version[nchar(version)>0][2]
+  splv <- as.numeric(strsplit(version,"[-.]")[[1]])
+  if (is.null(at.least)) {
+    list(major=splv[1],minor=splv[2],rev=splv[3],version.string=version)
+  } else {
+    minv <- as.numeric(strsplit(as.character(at.least),"[-.]")[[1]])
+    (splv[1]>minv[1]) ||
+    (splv[1]==minv[1]) && (splv[2]>minv[2]) ||
+    (splv[1]==minv[1]) && (splv[2]==minv[2]) && (splv[3]>=minv[3])
+  }
+}
+



More information about the pomp-commits mailing list