[Robast-commits] r625 - in branches/robast-0.9/pkg: ROptEst/R RobAStRDA/R RobAStRDA/inst/AddMaterial/interpolation RobExtremes/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 12 21:46:31 CET 2013


Author: ruckdeschel
Date: 2013-03-12 21:46:31 +0100 (Tue, 12 Mar 2013)
New Revision: 625

Modified:
   branches/robast-0.9/pkg/ROptEst/R/interpolLM.R
   branches/robast-0.9/pkg/RobAStRDA/R/interpolAux.R
   branches/robast-0.9/pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R
   branches/robast-0.9/pkg/RobExtremes/R/SnQn.R
   branches/robast-0.9/pkg/RobExtremes/R/getStartIC.R
Log:
Some bug fixing: .readGridFromCSV, spaces get deleted in names of parametric Families (SnQn.R, getStartIC), lists must grow incrementally (.saveGridToRda); case includeGrids=NULL must be treated separately... 

Modified: branches/robast-0.9/pkg/ROptEst/R/interpolLM.R
===================================================================
--- branches/robast-0.9/pkg/ROptEst/R/interpolLM.R	2013-03-12 19:32:16 UTC (rev 624)
+++ branches/robast-0.9/pkg/ROptEst/R/interpolLM.R	2013-03-12 20:46:31 UTC (rev 625)
@@ -80,7 +80,11 @@
 }
 
 .readGridFromCSV <- function(fromFileCSV){
-  Grid <- as.matrix(read.csv(fromFileCSV)); dimnames(Grid) <- NULL
+  rg <- read.table(CSVFiles[1], colClasses=rep("character",2), sep=" ", header=FALSE)
+  nrg <- nrow(rg)
+  Grid <- matrix(as.numeric(as.matrix(rg)),nrow=nrg)
+
+  as.matrix(read.csv(fromFileCSV)); dimnames(Grid) <- NULL
   fromFileTXT <- gsub("(.+\\.)csv$","\\1txt",fromFileCSV)
   res2 <- scan(file=fromFileTXT, what=c("character","character"))
   return(list(Grid=Grid, namPFam=res2[1], namInSysdata=res2[2]))

Modified: branches/robast-0.9/pkg/RobAStRDA/R/interpolAux.R
===================================================================
--- branches/robast-0.9/pkg/RobAStRDA/R/interpolAux.R	2013-03-12 19:32:16 UTC (rev 624)
+++ branches/robast-0.9/pkg/RobAStRDA/R/interpolAux.R	2013-03-12 20:46:31 UTC (rev 625)
@@ -21,7 +21,11 @@
 }
 
 .readGridFromCSV <- function(fromFileCSV){
-  Grid <- as.matrix(read.csv(fromFileCSV)); dimnames(Grid) <- NULL
+  rg <- read.table(CSVFiles[1], colClasses=rep("character",2), sep=" ", header=FALSE)
+  nrg <- nrow(rg)
+  Grid <- matrix(as.numeric(as.matrix(rg)),nrow=nrg)
+
+  as.matrix(read.csv(fromFileCSV)); dimnames(Grid) <- NULL
   fromFileTXT <- gsub("(.+\\.)csv$","\\1txt",fromFileCSV)
   res2 <- scan(file=fromFileTXT, what=c("character","character"))
   return(list(Grid=Grid, namPFam=res2[1], namInSysdata=res2[2]))
@@ -102,7 +106,6 @@
       nameInSysdata <- CSVlist[[i]]$namInSysdata
       namPFam <- CSVlist[[i]]$namPFam
       Grid <- CSVlist[[i]]$Grid
-      GridFileName <- paste(sub("^\\.(.+)","\\1",nameInSysdata),".Rdata",sep="")
 
       ### check whether object nameInSysdata already exists (ie. some
       ##   grids for this family already exist) or not
@@ -141,7 +144,12 @@
                 }
                 l.ng <- -1
              }else l.ng <- -2
-          }else l.ng <- length(InterpGrids)+1
+          }else {
+             l.ng <- length(InterpGrids)+1
+             InterpGrids[[l.ng]] <- InterpGrids[[l.ng-1]]
+             InterpGrids[[l.ng]]$fct.O <- NULL
+             InterpGrids[[l.ng]]$fct.N <- NULL
+          }
       }
       if(l.ng>0){ ## a new family is entered
          InterpGrids[[l.ng]]$grid <- Grid
@@ -194,7 +202,7 @@
             includeGrids = includeGrids , includeNams = includeNams,
             excludeGrids = excludeGrids , excludeNams = excludeNams)
 
-  funN <- paste("fun.", if(getRversion()>="2.16") "N" else "O", sep = "")
+  funN <- .versionSuff("fun")
 
   whatIsThereAlready <-  ls(all.names=TRUE, envir=samEnv)
   wprint(whatIsThereAlready)
@@ -221,7 +229,8 @@
   envir2 <- new.env()
   load(file,envir=envir2)
   what0 <- ls(all.names=TRUE,envir=envir2)
-  rm(list=what0[! what0 %in% includeGrids], envir=envir2)
+  if(!is.null(includeGrids))
+      rm(list=what0[! what0 %in% includeGrids], envir=envir2)
   rm(list=excludeGrids, envir=envir2)
   what1 <- ls(all.names=TRUE,envir=envir)
   what2 <- ls(all.names=TRUE,envir=envir2)

Modified: branches/robast-0.9/pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R
===================================================================
--- branches/robast-0.9/pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R	2013-03-12 19:32:16 UTC (rev 624)
+++ branches/robast-0.9/pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R	2013-03-12 20:46:31 UTC (rev 625)
@@ -15,12 +15,14 @@
 oldwd <- getwd()
 .basepath <- "C:/rtest/RobASt/branches/robast-0.9/pkg"
 .myFolderFrom <- file.path(.basepath,"RobExtremesBuffer")
-myRDA0 <- file.path(.basepath,"RobAStRDA/R/sysdata0.rda")
-myRDA <- file.path(.basepath,"RobAStRDA/R/sysdata.rda")
+#myRDA0 <- file.path(.basepath,"RobAStRDA/R/sysdata0.rda")
+#myRDA <- file.path(.basepath,"RobAStRDA/R/sysdata.rda")
+myRDA0 <- file.path(.basepath,"RobExtremesBuffer/sysdata0.rda")
+myRDA <- file.path(.basepath,"RobExtremesBuffer/sysdata.rda")
 CSVFiles <- grep("\\.csv$", dir(.myFolderFrom), value=TRUE)
 CSVFiles <- paste(.myFolderFrom, CSVFiles, sep="/")
 
 .saveGridToRda(CSVFiles, toFileRDA = myRDA0, withMerge = FALSE,
                withPrint = TRUE, withSmooth = TRUE, df = NULL)
 ##
-.computeInterpolators(myRDA0, myRDA)
\ No newline at end of file
+.computeInterpolators(myRDA0, myRDA)

Modified: branches/robast-0.9/pkg/RobExtremes/R/SnQn.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/SnQn.R	2013-03-12 19:32:16 UTC (rev 624)
+++ branches/robast-0.9/pkg/RobExtremes/R/SnQn.R	2013-03-12 20:46:31 UTC (rev 625)
@@ -116,13 +116,13 @@
 }
 
 setMethod("Sn", signature(x = "GPareto"),
-    function(x, ...).Sn.intp(x,"Generalized Pareto Family") )
+    function(x, ...).Sn.intp(x,"GeneralizedParetoFamily") )
 
 setMethod("Sn", signature(x = "GEV"),
-    function(x, ...).Sn.intp(x,"GEV Family") )
+    function(x, ...).Sn.intp(x,"GEVFamily") )
 
 setMethod("Sn", signature(x = "Gammad"),
-    function(x, ...).Sn.intp(x,"Gamma Family") )
+    function(x, ...).Sn.intp(x,"GammaFamily") )
 
 setMethod("Sn", signature(x = "Weibull"),
-    function(x, ...).Sn.intp(x,"Weibull Family") )
+    function(x, ...).Sn.intp(x,"WeibullFamily") )

Modified: branches/robast-0.9/pkg/RobExtremes/R/getStartIC.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/getStartIC.R	2013-03-12 19:32:16 UTC (rev 624)
+++ branches/robast-0.9/pkg/RobExtremes/R/getStartIC.R	2013-03-12 20:46:31 UTC (rev 625)
@@ -4,7 +4,7 @@
     mc <- match.call(expand.dots=TRUE)
 
     gridn <- type(risk)
-    nam <- name(model)
+    nam <- gsub(" ","",name(model))
     param1 <- param(model)
     nsng <- character(0)
     sng <- try(getFromNamespace(gridn, ns = "RobAStRDA"), silent=TRUE)



More information about the Robast-commits mailing list