[R] command to expand a cross classification / contingency table

Juliet Hannah juliet.hannah at gmail.com
Tue Oct 14 04:57:13 CEST 2008


For data such as

mydata <- read.table(textConnection("Var1 Response Count
A 1 1
A 2 2
B 6 3
A 7 3"),header=TRUE)
closeAllConnections()

is there a command to transform this data so that there is a single
observation per row?

A 1
A 2
A 2
B 6
B 6
B 6
A 7
A 7
A 7

Thanks,

Juliet



More information about the R-help mailing list