commit 490459cd629bb9d8ca46d767e89d3483181d8620
parent f40553d9f7b77eaa5bb5fe3172d2d14f94700f57
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Fri, 21 Aug 2015 14:11:33 -0400
Switching to more reliable syntax for getting vectors from data.frames.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jags-Yord-Xnom1grp-Mnormal.R b/Jags-Yord-Xnom1grp-Mnormal.R
@@ -13,7 +13,7 @@ genMCMC = function( datFrm, yName , numSavedSteps=50000 , thinSteps = 1,
nChains=nChainsDefault ) {
#-----------------------------------------------------------------------------
# THE DATA.
- y = as.numeric(datFrm[,yName])
+ y = as.numeric(datFrm[[yName]])
# Do some checking that data make sense:
if ( any( y!=round(y) ) ) { stop("All y values must be integers (whole numbers).") }
if ( any( y < 1 ) ) { stop("All y values must be 1 or larger.") }
@@ -180,7 +180,7 @@ plotMCMC = function( codaSamples , datFrm , yName , compVal , #RopeEff=NULL ,
layout( matrix( c(1,2,3,4,5,6) , nrow=3, byrow=TRUE ) )
par( mar=c(3.5,3.5,2.5,0.5) , mgp=c(2.25,0.7,0) )
# Compute limits for plots of data with posterior pred. distributions
- y = as.numeric(datFrm[,yName])
+ y = as.numeric(datFrm[[yName]])
# COMPRESS OUT ANY EMPTY VALUES OF Y:
yOrig=y
y=as.numeric(factor(y,levels=names(table(y))))