trinker / qdap

Quantitative Discourse Analysis Package: Bridging the gap between qualitative data and quantitative analysis
http://cran.us.r-project.org/web/packages/qdap/index.html
175 stars 44 forks source link

Add summary to cmspans #132

Closed trinker closed 11 years ago

trinker commented 11 years ago

Possibly add a summary method for class cmspans. This would also be plottable (have its own plot using qheat). Here's an example:

x <- summary(mtcars)
class(x)
plot(x)

class(mtcars) <- c('cds', class(mtcars))

summary.cds <- function(x, ...) {
class(x) <- "data.frame"
y <- colMeans(x)
class(y) <- c("sum.cds", class(y))
y

}

print.sum.cds <- function(x, ...) {
class(x) <- class(x)[!class(x) %in% "sum.cds"]
print(x)
}

plot.sum.cds <- function(x, ...) {
    class(x) <- class(x)[!class(x) %in% "sum.cds"]
    plot(x, col ="red", pch=19, ...)
}

plot(summary(mtcars))
trinker commented 11 years ago

Some summary stats I was thinking of:

sums, sd, percent, sum(percent) of spans by code. Also would need to handle repeated measures.

Time would be different than word. So the which.cm would be needed to determine which is which and print/plot accordingly.