Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Avi Gross via R-help
Kai, It is easier to want to help someone if they generally know what they are doing and are stuck on something. Less so when they do not know enough to explain to us what they want, show what they did, and so on. I modified the data you showed and hopefully it can be recreated this way:

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
Got it.Thank you. On Friday, August 13, 2021, 03:03:26 PM PDT, Bert Gunter 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

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Bert Gunter
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

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
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 |

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread John Kane
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

Re: [R] How to modify rows matching patter on multiple columns of dataframe?

2021-08-13 Thread Luigi Marongiu
Thank you! both hacks worked as needed! On Thu, Aug 12, 2021 at 6:59 PM Rui Barradas wrote: > > Hello, > > And another way, with which(., arr.ind = TRUE). > In two steps, to make it clearer. > > > i <- which(df[grep("var[123]", names(df))] == "a", arr.ind = TRUE) > df[i] <- "z" > > df > # var1