Hello,

Your request is not entirely clear.

What kind of a graph do you want? A bar graph with a bar of the fraction of positive levels of PASP per each level of SUBJC?
You need to be more specific.

Also, please post data like this:

# post the output of this command in your next mail
dput(head(data, 30))


Hope this helps,

Rui Barradas


Às 17:47 de 18-07-2018, Francesca escreveu:
Dear R help,

I am new to ggplot so I apologize if my question is a bit obvious.

I would like to create a plot where a compare the fraction of the values of a 
variable called PASP out of the number of subjects, for two groups of subject 
codified with a dummy variable called SUBJC.

The variable PASP is discrete and only takes values 0,4,8..

My data are as following:

PASP   SUBJC

0          0

4          1

0          0

8          0

4          0

0          1

0          1

.           .

.           .

.           .




I would like to calculate the fraction of positive levels of PASP out of the 
total number of observations, divided per values of SUBJ=0 and 1. I am new to 
the use of GGPlot and I do not know how to organize the data and what to use to 
summarize these data as to obtain a picture as follows:





I hope my request is clear. Thanks for any help you can provide.

Francesca



______________________________________________
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.


______________________________________________
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.

Reply via email to