-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of Nicole Ford
Sent: Monday, February 25, 2013 7:57 AM
To: R help
Subject: [R] colors to pie chart.
hello, all.
i am trying something new and am stuck. i typically go with whatever
colors the pie function pops out, but i would like to customize it.
please find below a sample dataset.
##TVs per household.
TVs <- factor(c(rep("0", 1), rep("1", 16), rep("2", 14), rep("3", 12),
rep("4", 3), rep("5", 2), rep("6", 2)))
##this runs just fine.
pie(table(TVs))
##however, when i add:
colors <- c("cyan3","magenta","darkblue","darkmagenta","darkred",
"darkgoldenrod1", "deeppink")
##and then:
pie(table(TVs, col=colors))
i receive this error.
Error in table(TVs, col = colors) :
all arguments must have the same length
i have tried it a few different ways (changing color names, adding cex
arguments, etc), with same results.