I have an excel sheet similar to the example below but with many rows and columns.
ID | HT | Stroke | HT follow up | Stroke follow up |
---|---|---|---|---|
1 | No | No | Yes | No |
2 | Yes | No | No | No |
3 | Missing | Yes | Missing | No |
HT refers to hypertension. I wanted to create a barplot showing the number of rows with "no" or "missing" for HT, and the number of rows with "yes" or "missing" for HT follow up. The y axis would be the number of counts and the x axis would be divided into two parts; ht and ht follow up, each part with two bars. What i did so far was create a dataset with the columns id, ht, and ht follow up. This dataset has the rows filtered to have ht rows that are either "no" or "filtered", and ht follow up rows that are either "yes" or "missing".
ht=exceldata[,c('id','HT','HTFU')]
ht1=subset(ht, HT=="No"|HT=="Missing")
ht2=subset(ht1,HTFU=="Yes"|HTFU=="Missing")
Any help would be appreciated!