Got it.Thank you. On Friday, August 13, 2021, 03:03:26 PM PDT, Bert Gunter <bgunter.4...@gmail.com> wrote: It's dput() *not* dupt() . ?dput tells you how to use it (as usual).
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Aug 13, 2021 at 2:48 PM Kai Yang via R-help <r-help@r-project.org> wrote: > > Hello John, > I put my testing data below. I'm not sure how to use dupt() function. would > you please give me an example? > Thanks, > Kai > > | > ethnicity | > individuals | > | Caucasian | 36062 | > | Ashkenazi Jewish | 4309 | > | Multiple | 3193 | > | Hispanic | 2113 | > | Asian. not specified | 1538 | > | Chinese | 1031 | > | African | 643 | > | Unknown | 510 | > | Filipino | 222 | > | Japanese | 129 | > | Native American | 116 | > | Indian | 111 | > | Pacific Islander | 23 | > > > > On Friday, August 13, 2021, 06:21:29 AM PDT, John Kane ><jrkrid...@gmail.com> wrote: > > Would you supply some sample data please? A handy way to supply sample > data is to use the dput() function. See ?dput. If you have a very > large data set then something like head(dput(myfile), 100) will likely > supply enough data for us to work with. > > On Thu, 12 Aug 2021 at 11:45, Kai Yang via R-help <r-help@r-project.org> > wrote: > > > > Hello List, > > I use the following code to generate a donut plot. > > # Compute percentages > > eth$fraction = eth$individuals / sum(eth$individuals) > > # Compute the cumulative percentages (top of each rectangle) > > eth$ymax = cumsum(eth$fraction) > > # Compute the bottom of each rectangle > > eth$ymin = c(0, head(eth$ymax, n=-1)) > > # Make the plot using percentage > > ggplot(eth, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ethnicity)) + > > geom_rect() + > > coord_polar(theta="y") + > > xlim(c(2, 4) > > ) > > > > I want to improve the plot for two thing: > > 1. the legend: I need to add percentage (eth$fraction * 100 and then add %) > > for each of element. > > 2. remove all number (tick mark ?) around the plot > > Please help > > Thank you, > > Kai > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > > > -- > John Kane > Kingston ON Canada > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.