Re: [R] Two geom_bar with counts to put in the same plot

2019-12-05 Thread Rui Barradas
Hello, A ggplot graph follows almost exactly my previous code. The *only* difference is in facet_wrap(). See below. library(ggplot2) idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE) dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv) dblong <- reshape2::melt(dblong, i

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-05 Thread Francesca
This is a consolation, because I cannot get it in ggplot either! Thanks for the code! F. > Il giorno 5 dic 2019, alle ore 11:17, Jim Lemon ha > scritto: > > Sorry it's not ggplot, I couldn't work that one out. > > # using the data frame structure that Rui kindl

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-05 Thread Francesca
Exactly. I was trying to remelt data in the right way, but I could not get there yet. Can you suggest me this code? Thanks a lot F. -- > Il giorno 5 dic 2019, alle ore 11:11, Jim Lemon ha > scritto: > > Hi Francesca, > Do you want something like this? > > Jim

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-05 Thread Jim Lemon
Hi Francesca, Do you want something like this? Jim On Thu, Dec 5, 2019 at 6:58 PM Francesca wrote: > > Hi, sorry for bothering again. > I was wondering how I can reshape the data, if in your code, > I would like to have only two panels, where in the panel with Participation > =0, I represent de

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Francesca
Hi, sorry for bothering again. I was wondering how I can reshape the data, if in your code, I would like to have only two panels, where in the panel with Participation =0, I represent delta11_L of participation1==0 and delta2_L of participation2==0, and in the right panel, I want Participation=1

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Francesca
Hi! It is not exactly what I wanted but more than I suspected I could get. Thanks a lot, this is awesome! Francesca On Wed, 4 Dec 2019 at 14:04, Rui Barradas wrote: > Hello, > > Please keep R-Help in the thread. > > As for the question, the following divides by facets, participation1/2 > with va

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Rui Barradas
Hello, Is it as simple as this? The code below does not separate the participant1 and participant2, only the 'delta' variables. idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE) dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv) head(dblong) ggplot(dblong, aes(x = val

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-03 Thread Francesca
Hi here it is;. THANKS! dput(DATASET) structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1

Re: [R] Two geom_bar with counts to put in the same plot

2019-12-03 Thread Rui Barradas
Hello, Please post the output of dput(DB) in a next e-mail to R-Help, like this it's difficult for us to use the data you posted. And yes, I bet you will need the data in long format. It is a frequent first step to the problem of plotting two or more columns in the same graph. To say more

[R] Two geom_bar with counts to put in the same plot

2019-12-03 Thread Francesca
Dear Contributors, I would like to ask help on how to create a plot that is the overlapping of two other plots. It is a geom_bar structure, where I want to count the occurrences of two variables, participation1 and participation2 that I recoded as factors as ParticipationNOPUN and ParticipationPUN