[Distr-commits] r85 - pkg/distrSim/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Feb 23 05:31:05 CET 2008
Author: ruckdeschel
Date: 2008-02-23 05:31:05 +0100 (Sat, 23 Feb 2008)
New Revision: 85
Added:
pkg/distrSim/R/01.R
Removed:
pkg/distrSim/R/010.R
Modified:
pkg/distrSim/R/SeqDataFrames-Class.R
pkg/distrSim/R/indexing-methods.R
pkg/distrSim/R/print-show-methods.R
Log:
fixed some errors in indexing and printing SeqDataFrames
Copied: pkg/distrSim/R/01.R (from rev 84, pkg/distrSim/R/010.R)
===================================================================
--- pkg/distrSim/R/01.R (rev 0)
+++ pkg/distrSim/R/01.R 2008-02-23 04:31:05 UTC (rev 85)
@@ -0,0 +1,36 @@
+.onLoad <- function(lib, pkg){
+ require("methods", character = TRUE, quietly = TRUE)
+ require(setRNG)
+}
+
+setClassUnion("vectororNULL", c("vector","NULL"))
+
+.distrSimoptions <- list(
+ MaxNumberofPlottedObs = 4000,
+ MaxNumberofPlottedObsDims = 6,
+ MaxNumberofPlottedRuns = 6,
+ MaxNumberofSummarizedObsDims = 6,
+ MaxNumberofSummarizedRuns = 6,
+ MaxNumberofPrintedObsDims = 10,
+ MaxNumberofPrintedObs = 10,
+ MaxNumberofPrintedRuns = 100
+ )
+
+
+.onAttach <- function(library, pkg)
+{
+ unlockBinding(".distrSimoptions", asNamespace("distrSim"))
+ msga <- gettext(
+ "Some functions from package 'stats' are intentionally masked\n---see distrSimMASK().\n"
+ )
+ buildStartupMessage(pkg="distrSim", msga, packageHelp=TRUE, library=library,
+ # MANUAL="http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf",
+ VIGNETTE = gettext("Package \"distrDoc\" provides a vignette to this package as well as\nto several related packages; try vignette(\"distr\")."))
+###
+ invisible()
+}
+
+distrSimMASK <- function(library = NULL)
+{
+ infoShow(pkg = "distrSim", filename="MASKING", library = library)
+}
Deleted: pkg/distrSim/R/010.R
===================================================================
--- pkg/distrSim/R/010.R 2008-02-23 03:41:59 UTC (rev 84)
+++ pkg/distrSim/R/010.R 2008-02-23 04:31:05 UTC (rev 85)
@@ -1,36 +0,0 @@
-.onLoad <- function(lib, pkg){
- require("methods", character = TRUE, quietly = TRUE)
- require(setRNG)
-}
-
-setClassUnion("vectororNULL", c("vector","NULL"))
-
-.distrSimoptions <- list(
- MaxNumberofPlottedObs = 4000,
- MaxNumberofPlottedObsDims = 6,
- MaxNumberofPlottedRuns = 6,
- MaxNumberofSummarizedObsDims = 6,
- MaxNumberofSummarizedRuns = 6,
- MaxNumberofPrintedObsDims = 10,
- MaxNumberofPrintedObs = 10,
- MaxNumberofPrintedRuns = 100
- )
-
-
-.onAttach <- function(library, pkg)
-{
- unlockBinding(".distrSimoptions", asNamespace("distrSim"))
- msga <- gettext(
- "Some functions from package 'stats' are intentionally masked\n---see distrSimMASK().\n"
- )
- buildStartupMessage(pkg="distrSim", msga, packageHelp=TRUE, library=library,
- # MANUAL="http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf",
- VIGNETTE = gettext("Package \"distrDoc\" provides a vignette to this package as well as\nto several related packages; try vignette(\"distr\")."))
-###
- invisible()
-}
-
-distrSimMASK <- function(library = NULL)
-{
- infoShow(pkg = "distrSim", filename="MASKING", library = library)
-}
Modified: pkg/distrSim/R/SeqDataFrames-Class.R
===================================================================
--- pkg/distrSim/R/SeqDataFrames-Class.R 2008-02-23 03:41:59 UTC (rev 84)
+++ pkg/distrSim/R/SeqDataFrames-Class.R 2008-02-23 04:31:05 UTC (rev 85)
@@ -1,8 +1,8 @@
-seqDataFrames <- function(...) new("SeqDataFrames", ...)
+seqDataFrames <- function(...) new("SeqDataFrames", data=list(...))
## Access methods
-setMethod("samplesize", "SeqDataFrames", function(object) numeric(lapply(object at data,function(y) nrow(y))))
+setMethod("samplesize", "SeqDataFrames", function(object) as.numeric(lapply(object at data,function(y) nrow(y))))
setMethod("obsDim", "SeqDataFrames", function(object) ncol(object at data[[1]]))
setMethod("runs", "SeqDataFrames", function(object) length(object at data))
setMethod("obsdimnames", "SeqDataFrames", function(object) colnames(object at data[[1]]))
Modified: pkg/distrSim/R/indexing-methods.R
===================================================================
--- pkg/distrSim/R/indexing-methods.R 2008-02-23 03:41:59 UTC (rev 84)
+++ pkg/distrSim/R/indexing-methods.R 2008-02-23 04:31:05 UTC (rev 85)
@@ -21,15 +21,16 @@
}})
setReplaceMethod("[", "SeqDataFrames", function(x, i, j, k, value){
+ if(missing(k)) k <- 1:length(x at data)
if(length(k)==1){
if((k<=length(x at data))||!is(try(x at data[[k]],silent=TRUE),"try-error"))
{zl <- x at data
z <- zl[[k]]
if (missing(i))
- {
- if(!is.null(dim(value)))
- z <- data.frame(matrix(NA,nrow(value),ncol(x at data[[1]])))
- else z <- data.frame(matrix(NA,length(value),ncol(x at data[[1]])))
+ { i <- 1:nrow(z)
+ #if(!is.null(dim(value)))
+ # z <- data.frame(matrix(NA,nrow(value),ncol(x at data[[1]])))
+ # else z <- data.frame(matrix(NA,length(value),ncol(x at data[[1]])))
}
z[i,j] <- value
zl[[k]] <- z
@@ -45,7 +46,6 @@
if(missing(j)) j <- 1:ncol(x at data[[1]])
if(missing(i)) i <- lapply(1:length(x at data),function(y) 1:nrow(x at data[[y]]))
- if(missing(k)) k <- 1:length(x at data)
if(is(value, "SeqDataFrames")) value <- value at data
@@ -71,8 +71,8 @@
zl <- x at data
for(kk in 1:kll)
- {z <- x at data[[kl0[kk]]]
- z[c(unlist(i)),j] <- value[kk]
+ {z <- zl[[kl0[kk]]]
+ z[c(unlist(i[[kl0[kk]]])),j] <- value[kk]
zl[[kl0[kk]]] <- z
}
x at data <- zl
Modified: pkg/distrSim/R/print-show-methods.R
===================================================================
--- pkg/distrSim/R/print-show-methods.R 2008-02-23 03:41:59 UTC (rev 84)
+++ pkg/distrSim/R/print-show-methods.R 2008-02-23 04:31:05 UTC (rev 85)
@@ -68,13 +68,13 @@
nobsDims <- obsDim(x)
nobs <- samplesize(x)
if(short) {
- nruns <- min(runs(x),distrSimoption("MaxNumberofPrintedRuns"))
- nobsDims <- min(obsDim(x),distrSimoption("MaxNumberofPrintedObsDims"))
- obs <- lapply(x at data, function(y) min(nrow(y),distrSimoption("MaxNumberofPrintedObs")))
+ nruns <- min(runs(x),getdistrSimOption("MaxNumberofPrintedRuns"))
+ nobsDims <- min(obsDim(x),getdistrSimOption("MaxNumberofPrintedObsDims"))
+ nobs <- lapply(x at data, function(y) min(nrow(y),getdistrSimOption("MaxNumberofPrintedObs")))
}
for(k in 1:nruns){
cat(names(x)[k],":\n")
- print(x at data[1:obs[[k]],1:nobsDims])}
+ print(x at data[[k]][1:nobs[k],1:nobsDims])}
})
setMethod("show", "SeqDataFrames",
More information about the Distr-commits
mailing list