[R] GGPlot plot

Francesca fr@nce@c@@p@ncotto @ending from gm@il@com
Wed Jul 18 18:47:40 CEST 2018


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





More information about the R-help mailing list