Hi > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@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.
Did you try changing position of parentheses? pie(table(TVs), col=colors) col is parameter for pie not for table. Regards Petr > > i am not sure why i would be getting this message if it works without > the color functionality. i did a quick search which yielded nothing of > value. > > thanks in advance. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.