R/pplot.R

pplot <-
function (x, g, colors, pch, add = FALSE, type = "p", ...) 
{
    g <- as.factor(g)
    cc <- as.numeric(g)
    np <- seq(levels(g))
    if (missing(colors)) 
        colors <- np + 1
    else colors <- rep(colors, length = length(np))
    if (missing(pch)) 
        pch <- paste(np)
    else pch <- rep(pch, length = length(np))
    if (!add) 
        plot(x, type = "n", ...)
    for (i in unique(cc)) points(x[cc == i, , drop = FALSE], col = colors[i], 
        pch = pch[i], type = type)
}

Try the mda package in your browser

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

mda documentation built on July 9, 2023, 7:14 p.m.