[Basta-users] rowSums(bd) error on DataCheck

Caroline Chong caroline.chong at anu.edu.au
Wed Sep 11 05:26:49 CEST 2013


Dear All- I am having difficulty troubleshooting the following rowSums(bd) error on running DataCheck, and would be extremely grateful for any solutions or suggestions you might have.

for dates I am using the format yyyy-mm-dd and have 1420 observations across each of my three input matrices (observation dates, births and deaths, covariates).

when I run inputMat <- as.data.frame (see below) the individual sample names, 1501c1 etc, are not removed from the matrix.

If I alternatively run the merge commands
inputMat <- merge(birthDeath, Y, by.x = "ID", by.y = "ID")
inputMat <- merge(inputMat, covMat, by.x = "ID", by.y = "ID")
the individual sample names are removed in the merged matrix, but the same rowSums error is returned on running DataCheck.

I would be exceedingly appreciative of your help solving this one....

with thanks and
best regards,
Caroline.

cv <- read.delim("~/fixed_ROBSDATESuse3.csv", sep=",", header=T)
rd <- cv$ROBSDATES
class(rd)
sum(is.na(cv))
rd<-as.Date(rd)
Y <- CensusToCaptHist(ID = cv[,1], d=rd, timeInt="D")
head(Y)
 birthDeath <- read.delim("~/fixed_birthdeath.csv", sep=",", header=T)
head(birthDeath)
covar <- read.delim("~/fixed_covars.csv", sep=",", header=T)
covMat <- MakeCovMat(x=c("CLADE"), data = covar)
inputMat <- as.data.frame(cbind(birthDeath, Y[, -1], covMat[, -1]))
DataCheck(inputMat, studyStart = 1, studyEnd = 109, autofix = rep(1, 7), silent=FALSE)
Error in rowSums(bd) : 'x' must be numeric


> head(inputMat)
        ID realROBSBIRTH realSENDEATH 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
1501c1   1             0   2012-09-19 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
1501c2   2             0   2012-09-19 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
1501c3   3             0            0 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
1501n1   4    2012-07-14            0 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
1501n10 13    2012-07-14            0 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
1501n11 14    2012-07-14            0 1 0

> inputMat <- merge(birthDeath, Y, by.x = "ID", by.y = "ID")
> inputMat <- merge(inputMat, covMat, by.x = "ID", by.y = "ID")
> print(inputMat)
       ID realROBSBIRTH realSENDEATH 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
1       1             0   2012-09-19 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
2       2             0   2012-09-19 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
3       3             0            0 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
4       4    2012-07-14            0 1 0 0 0 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/basta-users/attachments/20130911/125ac6e2/attachment.html>


More information about the Basta-users mailing list