Skip to content
Prev 301177 / 398503 Next

creating Pivot

Hello,

Try the following.

dat <- read.table(text="
  color    name  values
R          XXX     10
G          YYY      4
Y           ZZZ      5
G          XXX     2
Y         XXX     3
R          YYY      2
Y          YYY       1
R         ZZZ       2
G         ZZZ       3
", header=TRUE)
d

xtabs(values ~ name + color, data=dat)

Hope this helps,

Rui Barradas
Em 25-07-2012 05:41, namit escreveu: