R/sm2list.R

#####################################
#adapted from code written by
#Jarrod Hadfield in the 
#MCMCglmm package
######################################
sm2list<-function (A = NULL, rownames = NULL, colnames=c("row", "column", "A"))
{
    ginv <- data.frame(Row = rep(1:length(A@p[-1]),
        diff(A@p)), Column = A@i + 1, Ainverse = A@x)
    ginv <- ginv[order(ginv$Row), ]
    ginv <- ginv[which(ginv$Row >= ginv$Column), ]
    attr(ginv, "rowNames") <- rownames
    names(ginv)<-colnames
    return(ginv)
}

Try the nadiv package in your browser

Any scripts or data that you put into this service are public.

nadiv documentation built on May 2, 2019, 4:55 p.m.