R/sampsna.R

Defines functions sampsna

Documented in sampsna

sampsna = function(tree) {
    s = nrow(tree$sna)
    sna = tree$sna
    sna.change = sample.int(min(4, sample.int(1, n = s)), n = s)
    sna.edge = sample(2:nrow(tree$edge), size = length(sna.change), replace = TRUE)
    sna[sna.change, 2:3] = tree$edge[sna.edge, 1:2]
    return(sna)
} 

Try the Canopy package in your browser

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

Canopy documentation built on Dec. 23, 2017, 5:09 p.m.