[Gmpm-commits] r19 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 15 22:21:32 CEST 2010
Author: dalebarr
Date: 2010-09-15 22:21:31 +0200 (Wed, 15 Sep 2010)
New Revision: 19
Modified:
pkg/R/gmpm.R
pkg/R/helpers.R
Log:
bug fix for between-unit relabeling
Modified: pkg/R/gmpm.R
===================================================================
--- pkg/R/gmpm.R 2010-07-13 19:10:47 UTC (rev 18)
+++ pkg/R/gmpm.R 2010-09-15 20:21:31 UTC (rev 19)
@@ -1184,10 +1184,18 @@
flvl <- xt3[j,1:(ncol(xt3)-1)]
labs <- flvl
# defactorize
- for (p in 1:ncol(labs)) {
- labs[,p] <- levels(labs[,p])[labs[,p]]
+
+ if (is.data.frame(labs)) {
+ for (p in 1:ncol(labs)) { # error when labs is vector
+ labs[,p] <- levels(labs[,p])[labs[,p]]
+ }
+ } else {
+ if (is.factor(labs)) {
+ labs <- levels(labs)[labs]
+ names(labs) <- colnames(xt3)[1]
+ } else {}
}
- tname <- paste(labs,collapse=":")
+ tname <- paste(labs,collapse=":")
llist <- list()
for (k in 1:length(lvl)) {
Modified: pkg/R/helpers.R
===================================================================
--- pkg/R/helpers.R 2010-07-13 19:10:47 UTC (rev 18)
+++ pkg/R/helpers.R 2010-09-15 20:21:31 UTC (rev 19)
@@ -126,7 +126,7 @@
}
.gmpmCtrl <- function(maxruns = 999, report.interval=10,
- outfile = NULL, nCores="all")
+ outfile = NULL, nCores=1)
{
return(list(maxruns=maxruns, report.interval=report.interval,
outfile=outfile, nCores=nCores))
@@ -208,6 +208,7 @@
library(multicore)
if (gmpmControl[["nCores"]] == "all") {
nCores = multicore:::detectCores()
+ nCores = 1
} else {
if (gmpmControl[["nCores"]] == "all.but.one") {
nCores = multicore:::detectCores() - 1
More information about the Gmpm-commits
mailing list