mayoverse/kinship2

Plotting problem in 1.9.1.

Closed this issue · 1 comments

The following pedigrees plot nicely with the CRAN version (1.8.5) but not with the current dev version (1.9.1):

Version 1.8.5 (good)

library(kinship2, quietly = T)
packageVersion("kinship2")
#> [1] '1.8.5'

x1 = pedigree(id = 1:4, dad = c(0,0,1,3), mom = c(0,0,2,2), sex = c(1,2,1,1))
x2 = pedigree(id = 1:7, dad = c(0,0,1,1,1,1,3), mom = c(0,0,2,2,2,2,2), 
              sex = c(1,2,1,1,1,1,1))

par(mfrow = c(1,2))
plot(x1, mar = c(1,2,1,2))
plot(x2, mar = c(1,2,1,2))

Created on 2022-09-21 with reprex v2.0.2

Version 1.9.1 (bad)

library(kinship2, quietly = T)
packageVersion("kinship2")
#> [1] '1.9.1'

The first plots badly:

plot(x1)

The second does not plot at all:

plot(x2)
#> Error in myid[i, rval$nid[i, ] > 0] <- cumsum(c(0, rval$n))[i] + 1:rval$n[i]: number of items to replace is not a multiple of replacement length

Created on 2022-09-21 with reprex v2.0.2

I'm pretty sure the error lies in kindepth(..., align = TRUE) which gives different outputs in the two versions.