0

I have a .csv file with the following information:

  1. Group name
  2. Number of patients
  3. Hazard ratio
  4. Event rate for Control
  5. Event rate for Treatment
  6. P-value

I'd like to "build" something similar to the following in ggplot with just the information from the data frame (listed below):

enter image description here

I'm trying to avoid a forest plot like this:

Forest plot from cox object

Here is some sample data:

SubGroup     NumOfPatients  HazardRatio   LowerConInt  UpperConInt pVal
Overall      2166              1.50       .88          1.78        0.05
Over65       1534              1.79       1.05         1.92        0.13
Under65      632               0.66       .75          1.25        0.52
Male         1690              1.76       1.05         1.93        0.81
Female       476               0.65       .55          1.30        0.38

Any help would be appreciated.

statsguyz
  • 419
  • 2
  • 11
  • 35
  • Just a comment: csv files (.csv) are much simpler and not the same as Excel files (.xls or .xlsx). If you export a csv from Excel, it's just a CSV file now. – Gregor Thomas Sep 10 '18 at 14:02
  • 3
    Pertinent to the question: Can you show what you have so far? Do you know how to read your CSV into R? (If so, why is your question mentioning a file instead of a data frame in R? If not, what have you tried, and where are you stuck?) Have you tried plotting it? Can you share a little bit of sample data in a copy/pasteable format? – Gregor Thomas Sep 10 '18 at 14:04
  • 1
    And lastly, can you explain what you don't like about the forest plot you're "trying to avoid"? It looks very similar to the one you post in your question, and you don't explain what you don't like about the "avoid" one vs what you do like about your "goal" one. – Gregor Thomas Sep 10 '18 at 14:06
  • I can read the data in to R with data<-read.csv(filename). I guess this is a more "theoretical". I will post some dummy data and see what others can do with it. What I am trying to avoid is both the "Reference" entry where the Hazard ratio and 95% confidence interval are stated. – statsguyz Sep 10 '18 at 14:08
  • Could you please share the sample data using `dput()`? That would make it copy/pasteable. Since your `ConInt` column has both spaces and commas, it's difficult to import your sample data as-is, but if you give `dput(droplevels(your_data[1:5, ]))` it will be copy/pasteable. – Gregor Thomas Sep 10 '18 at 14:23
  • @Gregor I don't have a full data set now. I'm just posting this question to see if it's possible to recreate a similar plot without a "Survival" object. – statsguyz Sep 10 '18 at 14:26
  • I understand. The sample data you posted is hard to import to R because of the commas and spaces. I just want you to post that exact same sample data in an easily copy/pasteable format. – Gregor Thomas Sep 10 '18 at 14:27
  • Oh ok, I can remove that now. – statsguyz Sep 10 '18 at 14:47
  • 1
    I have to agree with the two close-voters that this remains unclear, but I'm holding off on voting, in part because I answered the earlier question that you cite. Please learn to use [edit] facilities to make a [MCVE]. And DO say what you want to see rather than saying what you don't want. – IRTFM Sep 11 '18 at 16:56

0 Answers0