Forest plot with table colomns on the right and left sideReproduce table and plot from journalSide-by-side plots with ggplot2How to join (merge) data frames (inner, outer, left, right)Side-by-side Forest Plot in Rforest plot three shapes in RForest plot doesn't match the sidetablelegend in a forest plotSave forest plot produced with rmetacol and row names in a Forest plotPlot side-by-side forest plots using forest function in meta packageForest plot in meta package in R

Why are electrically insulating heatsinks so rare? Is it just cost?

Is it canonical bit space?

Why is Collection not simply treated as Collection<?>

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

Why is the 'in' operator throwing an error with a string literal instead of logging false?

Today is the Center

CEO ridiculed me with gay jokes and grabbed me and wouldn't let go - now getting pushed out of company

Why doesn't H₄O²⁺ exist?

Where does SFDX store details about scratch orgs?

Combinations of multiple lists

Were any external disk drives stacked vertically?

What do you call someone who asks many questions?

How do I write bicross product symbols in latex?

I'm flying to France today and my passport expires in less than 2 months

How much of data wrangling is a data scientist's job?

Is the Joker left-handed?

What does it mean to describe someone as a butt steak?

What's the point of deactivating Num Lock on login screens?

Brothers & sisters

I Accidentally Deleted a Stock Terminal Theme

Has there ever been an airliner design involving reducing generator load by installing solar panels?



Forest plot with table colomns on the right and left side


Reproduce table and plot from journalSide-by-side plots with ggplot2How to join (merge) data frames (inner, outer, left, right)Side-by-side Forest Plot in Rforest plot three shapes in RForest plot doesn't match the sidetablelegend in a forest plotSave forest plot produced with rmetacol and row names in a Forest plotPlot side-by-side forest plots using forest function in meta packageForest plot in meta package in R






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I would like to use the script created by Thomas a couple of years ago to draw a forest plot. Unfortunately, the script is fitted to the data and need to be adjusted I case that treatment estimates and confidence interval are different.



To adapt the script to my data



  1. I updated the data frame containing treatment estimates and
    standard errors

  2. I changes the breaks of the x-axis to accommodate
    my data

But as you can see, the x-axis should be log-transformed. However, when I add log="x" to the plot() function, I get the following error message: Error in plot.window(...) : Logarithmic axis must have positive limits.
But the created plot did not fit on the panel if I change the xlim from xlim=c(-10,12) to xlim=c(1,12). Moreover, every x position of text on the left side of the plot need negative values.
Does anyone have an idea how to fix this?



Forest Plot



mydf <- data.frame(
SubgroupH=c('LV-EF',NA,NA,'Sex',NA,NA),
Subgroup=c(NA,'low','normal',NA,'female','male'),
NoOfPatients=c(NA,2815,1935,NA,3843,908),
HazardRatio=c(NA,1.07, 2.81,NA,1.69, 1.74),
HazardLower=c(NA,0.42, 1.26,NA,0.41, 0.96),
HazardUpper=c(NA,2.73, 6.26,NA,6.93, 3.16),
Pvalue=c(NA,0.77,0.17,NA,0.47,0.21),
PvalueI=c(0.46,NA,NA,0.46,NA,NA),
stringsAsFactors=FALSE
)

#################

rowseq <- seq(nrow(mydf),1)
par(mai=c(1,0,0,0))
plot(mydf$HazardRatio, rowseq, pch=15,
xlim=c(-10,12), ylim=c(0,7),
xlab='', ylab='', yaxt='n', xaxt='n',
bty='n')

axis(1, round(c(1/10, 1/5, 1, 5, 10),2), cex.axis=.5)

segments(1,-1,1,6.25, lty=3)
segments(mydf$HazardLower, rowseq, mydf$HazardUpper, rowseq)

mtext('Off-PumpnCABG Better',1, line=2.5, at=0, cex=.5, font=2)
mtext('On-PumpnCABG Better',1.5, line=2.5, at=2, cex=.5, font=2)

?text
text(-8,6.5, "Subgroup", cex=.75, font=2, pos=4)
t1h <- ifelse(!is.na(mydf$SubgroupH), mydf$SubgroupH, '')
text(-8,rowseq, t1h, cex=.75, pos=4, font=3)
t1 <- ifelse(!is.na(mydf$Subgroup), mydf$Subgroup, '')
text(-7.5,rowseq, t1, cex=.75, pos=4)

text(-5,6.5, "No. ofnPatients", cex=.75, font=2, pos=4)
t2 <- ifelse(!is.na(mydf$NoOfPatients), format(mydf$NoOfPatients,big.mark=","), '')
text(-3, rowseq, t2, cex=.75, pos=2)

text(-1,6.5, "Hazard Ratio (95%)", cex=.75, font=2, pos=4)
t3 <- ifelse(!is.na(mydf$HazardRatio), with(mydf, paste(HazardRatio,' (',HazardLower,'-',HazardUpper,')',sep='')), '')
text(3,rowseq, t3, cex=.75, pos=4)

text(7.5,6.5, "P Value", cex=.75, font=2, pos=4)
t4 <- ifelse(!is.na(mydf$Pvalue), mydf$Pvalue, '')
text(7.5,rowseq, t4, cex=.75, pos=4)

text(10,6.5, "P Value fornInteraction", cex=.75, font=2, pos=4)
t5 <- ifelse(!is.na(mydf$PvalueI), mydf$PvalueI, '')
text(10,rowseq, t5, cex=.75, pos=4)









share|improve this question




























    0















    I would like to use the script created by Thomas a couple of years ago to draw a forest plot. Unfortunately, the script is fitted to the data and need to be adjusted I case that treatment estimates and confidence interval are different.



    To adapt the script to my data



    1. I updated the data frame containing treatment estimates and
      standard errors

    2. I changes the breaks of the x-axis to accommodate
      my data

    But as you can see, the x-axis should be log-transformed. However, when I add log="x" to the plot() function, I get the following error message: Error in plot.window(...) : Logarithmic axis must have positive limits.
    But the created plot did not fit on the panel if I change the xlim from xlim=c(-10,12) to xlim=c(1,12). Moreover, every x position of text on the left side of the plot need negative values.
    Does anyone have an idea how to fix this?



    Forest Plot



    mydf <- data.frame(
    SubgroupH=c('LV-EF',NA,NA,'Sex',NA,NA),
    Subgroup=c(NA,'low','normal',NA,'female','male'),
    NoOfPatients=c(NA,2815,1935,NA,3843,908),
    HazardRatio=c(NA,1.07, 2.81,NA,1.69, 1.74),
    HazardLower=c(NA,0.42, 1.26,NA,0.41, 0.96),
    HazardUpper=c(NA,2.73, 6.26,NA,6.93, 3.16),
    Pvalue=c(NA,0.77,0.17,NA,0.47,0.21),
    PvalueI=c(0.46,NA,NA,0.46,NA,NA),
    stringsAsFactors=FALSE
    )

    #################

    rowseq <- seq(nrow(mydf),1)
    par(mai=c(1,0,0,0))
    plot(mydf$HazardRatio, rowseq, pch=15,
    xlim=c(-10,12), ylim=c(0,7),
    xlab='', ylab='', yaxt='n', xaxt='n',
    bty='n')

    axis(1, round(c(1/10, 1/5, 1, 5, 10),2), cex.axis=.5)

    segments(1,-1,1,6.25, lty=3)
    segments(mydf$HazardLower, rowseq, mydf$HazardUpper, rowseq)

    mtext('Off-PumpnCABG Better',1, line=2.5, at=0, cex=.5, font=2)
    mtext('On-PumpnCABG Better',1.5, line=2.5, at=2, cex=.5, font=2)

    ?text
    text(-8,6.5, "Subgroup", cex=.75, font=2, pos=4)
    t1h <- ifelse(!is.na(mydf$SubgroupH), mydf$SubgroupH, '')
    text(-8,rowseq, t1h, cex=.75, pos=4, font=3)
    t1 <- ifelse(!is.na(mydf$Subgroup), mydf$Subgroup, '')
    text(-7.5,rowseq, t1, cex=.75, pos=4)

    text(-5,6.5, "No. ofnPatients", cex=.75, font=2, pos=4)
    t2 <- ifelse(!is.na(mydf$NoOfPatients), format(mydf$NoOfPatients,big.mark=","), '')
    text(-3, rowseq, t2, cex=.75, pos=2)

    text(-1,6.5, "Hazard Ratio (95%)", cex=.75, font=2, pos=4)
    t3 <- ifelse(!is.na(mydf$HazardRatio), with(mydf, paste(HazardRatio,' (',HazardLower,'-',HazardUpper,')',sep='')), '')
    text(3,rowseq, t3, cex=.75, pos=4)

    text(7.5,6.5, "P Value", cex=.75, font=2, pos=4)
    t4 <- ifelse(!is.na(mydf$Pvalue), mydf$Pvalue, '')
    text(7.5,rowseq, t4, cex=.75, pos=4)

    text(10,6.5, "P Value fornInteraction", cex=.75, font=2, pos=4)
    t5 <- ifelse(!is.na(mydf$PvalueI), mydf$PvalueI, '')
    text(10,rowseq, t5, cex=.75, pos=4)









    share|improve this question
























      0












      0








      0








      I would like to use the script created by Thomas a couple of years ago to draw a forest plot. Unfortunately, the script is fitted to the data and need to be adjusted I case that treatment estimates and confidence interval are different.



      To adapt the script to my data



      1. I updated the data frame containing treatment estimates and
        standard errors

      2. I changes the breaks of the x-axis to accommodate
        my data

      But as you can see, the x-axis should be log-transformed. However, when I add log="x" to the plot() function, I get the following error message: Error in plot.window(...) : Logarithmic axis must have positive limits.
      But the created plot did not fit on the panel if I change the xlim from xlim=c(-10,12) to xlim=c(1,12). Moreover, every x position of text on the left side of the plot need negative values.
      Does anyone have an idea how to fix this?



      Forest Plot



      mydf <- data.frame(
      SubgroupH=c('LV-EF',NA,NA,'Sex',NA,NA),
      Subgroup=c(NA,'low','normal',NA,'female','male'),
      NoOfPatients=c(NA,2815,1935,NA,3843,908),
      HazardRatio=c(NA,1.07, 2.81,NA,1.69, 1.74),
      HazardLower=c(NA,0.42, 1.26,NA,0.41, 0.96),
      HazardUpper=c(NA,2.73, 6.26,NA,6.93, 3.16),
      Pvalue=c(NA,0.77,0.17,NA,0.47,0.21),
      PvalueI=c(0.46,NA,NA,0.46,NA,NA),
      stringsAsFactors=FALSE
      )

      #################

      rowseq <- seq(nrow(mydf),1)
      par(mai=c(1,0,0,0))
      plot(mydf$HazardRatio, rowseq, pch=15,
      xlim=c(-10,12), ylim=c(0,7),
      xlab='', ylab='', yaxt='n', xaxt='n',
      bty='n')

      axis(1, round(c(1/10, 1/5, 1, 5, 10),2), cex.axis=.5)

      segments(1,-1,1,6.25, lty=3)
      segments(mydf$HazardLower, rowseq, mydf$HazardUpper, rowseq)

      mtext('Off-PumpnCABG Better',1, line=2.5, at=0, cex=.5, font=2)
      mtext('On-PumpnCABG Better',1.5, line=2.5, at=2, cex=.5, font=2)

      ?text
      text(-8,6.5, "Subgroup", cex=.75, font=2, pos=4)
      t1h <- ifelse(!is.na(mydf$SubgroupH), mydf$SubgroupH, '')
      text(-8,rowseq, t1h, cex=.75, pos=4, font=3)
      t1 <- ifelse(!is.na(mydf$Subgroup), mydf$Subgroup, '')
      text(-7.5,rowseq, t1, cex=.75, pos=4)

      text(-5,6.5, "No. ofnPatients", cex=.75, font=2, pos=4)
      t2 <- ifelse(!is.na(mydf$NoOfPatients), format(mydf$NoOfPatients,big.mark=","), '')
      text(-3, rowseq, t2, cex=.75, pos=2)

      text(-1,6.5, "Hazard Ratio (95%)", cex=.75, font=2, pos=4)
      t3 <- ifelse(!is.na(mydf$HazardRatio), with(mydf, paste(HazardRatio,' (',HazardLower,'-',HazardUpper,')',sep='')), '')
      text(3,rowseq, t3, cex=.75, pos=4)

      text(7.5,6.5, "P Value", cex=.75, font=2, pos=4)
      t4 <- ifelse(!is.na(mydf$Pvalue), mydf$Pvalue, '')
      text(7.5,rowseq, t4, cex=.75, pos=4)

      text(10,6.5, "P Value fornInteraction", cex=.75, font=2, pos=4)
      t5 <- ifelse(!is.na(mydf$PvalueI), mydf$PvalueI, '')
      text(10,rowseq, t5, cex=.75, pos=4)









      share|improve this question














      I would like to use the script created by Thomas a couple of years ago to draw a forest plot. Unfortunately, the script is fitted to the data and need to be adjusted I case that treatment estimates and confidence interval are different.



      To adapt the script to my data



      1. I updated the data frame containing treatment estimates and
        standard errors

      2. I changes the breaks of the x-axis to accommodate
        my data

      But as you can see, the x-axis should be log-transformed. However, when I add log="x" to the plot() function, I get the following error message: Error in plot.window(...) : Logarithmic axis must have positive limits.
      But the created plot did not fit on the panel if I change the xlim from xlim=c(-10,12) to xlim=c(1,12). Moreover, every x position of text on the left side of the plot need negative values.
      Does anyone have an idea how to fix this?



      Forest Plot



      mydf <- data.frame(
      SubgroupH=c('LV-EF',NA,NA,'Sex',NA,NA),
      Subgroup=c(NA,'low','normal',NA,'female','male'),
      NoOfPatients=c(NA,2815,1935,NA,3843,908),
      HazardRatio=c(NA,1.07, 2.81,NA,1.69, 1.74),
      HazardLower=c(NA,0.42, 1.26,NA,0.41, 0.96),
      HazardUpper=c(NA,2.73, 6.26,NA,6.93, 3.16),
      Pvalue=c(NA,0.77,0.17,NA,0.47,0.21),
      PvalueI=c(0.46,NA,NA,0.46,NA,NA),
      stringsAsFactors=FALSE
      )

      #################

      rowseq <- seq(nrow(mydf),1)
      par(mai=c(1,0,0,0))
      plot(mydf$HazardRatio, rowseq, pch=15,
      xlim=c(-10,12), ylim=c(0,7),
      xlab='', ylab='', yaxt='n', xaxt='n',
      bty='n')

      axis(1, round(c(1/10, 1/5, 1, 5, 10),2), cex.axis=.5)

      segments(1,-1,1,6.25, lty=3)
      segments(mydf$HazardLower, rowseq, mydf$HazardUpper, rowseq)

      mtext('Off-PumpnCABG Better',1, line=2.5, at=0, cex=.5, font=2)
      mtext('On-PumpnCABG Better',1.5, line=2.5, at=2, cex=.5, font=2)

      ?text
      text(-8,6.5, "Subgroup", cex=.75, font=2, pos=4)
      t1h <- ifelse(!is.na(mydf$SubgroupH), mydf$SubgroupH, '')
      text(-8,rowseq, t1h, cex=.75, pos=4, font=3)
      t1 <- ifelse(!is.na(mydf$Subgroup), mydf$Subgroup, '')
      text(-7.5,rowseq, t1, cex=.75, pos=4)

      text(-5,6.5, "No. ofnPatients", cex=.75, font=2, pos=4)
      t2 <- ifelse(!is.na(mydf$NoOfPatients), format(mydf$NoOfPatients,big.mark=","), '')
      text(-3, rowseq, t2, cex=.75, pos=2)

      text(-1,6.5, "Hazard Ratio (95%)", cex=.75, font=2, pos=4)
      t3 <- ifelse(!is.na(mydf$HazardRatio), with(mydf, paste(HazardRatio,' (',HazardLower,'-',HazardUpper,')',sep='')), '')
      text(3,rowseq, t3, cex=.75, pos=4)

      text(7.5,6.5, "P Value", cex=.75, font=2, pos=4)
      t4 <- ifelse(!is.na(mydf$Pvalue), mydf$Pvalue, '')
      text(7.5,rowseq, t4, cex=.75, pos=4)

      text(10,6.5, "P Value fornInteraction", cex=.75, font=2, pos=4)
      t5 <- ifelse(!is.na(mydf$PvalueI), mydf$PvalueI, '')
      text(10,rowseq, t5, cex=.75, pos=4)






      r plot forestplot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 22:03









      GurkenhalsGurkenhals

      53




      53






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289940%2fforest-plot-with-table-colomns-on-the-right-and-left-side%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289940%2fforest-plot-with-table-colomns-on-the-right-and-left-side%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현