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

Owen Jones jonesor at gmail.com
Wed Sep 11 20:57:41 CEST 2013


Hi Caroline,

Your birth/death data need to be coded as integers that must match up with the columns in the observation matrix. 

To quote the help file: The first column is a vector of individual unique IDs, the second and third columns are birth and death years respectively. Columns 4-(nt-1) represent the observation window of nt years.

In your data, it looks like the birth/death information is recorded as dates, rather than years. You need to recode these to get BaSTA to work. If this isn't clear, please take a look at the formatting of our example dataset "sim1" in the package (do head(sim1))

Note that you could just as easily replace years with weeks, or months etc. as long as you are consistent, and as long as every week or month has its own column in the observation matrix.

Best wishes,
Owen


On 11 Sep 2013, at 05:49, Caroline Chong <caroline.chong at anu.edu.au> wrote:

> Dear All
> I have solved the individual sample names issue (re-ordering of the samples so they match across matrices...1, 2...n) so these are removed on running inputMat.
> 
> I look forward to any suggestions on solving or interpreting the rowSums(bd) error as per below....
> 
> many thanks,
> best,
> Caroline.
> 
> 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
> 
> 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
> _______________________________________________
> Basta-users mailing list
> Basta-users at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/basta-users



More information about the Basta-users mailing list