首页 > 解决方案 > 如何防止林地被砍伐?

问题描述

我正在创建几个森林地块,但它们都被切断了 RMD。可重现的例子:

author = c("aaaaaaaaaa", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "t", "u", "v", "w", "x")
Ne = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Me = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
SDe = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Nc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Mc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
SDc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)

df = data.frame(author, Ne, Me, SDe, Nc, Mc, SDc)

m.cont <- meta::metacont(n.e = Ne,
                   mean.e = Me,
                   sd.e = SDe,
                   n.c = Nc,
                   mean.c = Mc,
                   sd.c = SDc,
                   studlab = author,
                   data = df,
                   sm = "SMD",
                   method.smd = "Hedges",
                   fixed = FALSE,
                   random = TRUE,
                   method.tau = "REML",
                   hakn = TRUE,
                   title = "Example")

meta::forest.meta(m.cont, 
            sortvar = TE,
            predict = TRUE, 
            print.tau2 = FALSE,
            leftlabs = c("Author", "g", "SE"),
            xlim = "symmetric")

我知道我可以通过运行块获得完整的图形,而无需编织然后扩展图形,但我希望这些图可以在 knit html doc 中呈现。

标签: rplot

解决方案


只需在块标题中指定图形的宽度和高度。

---
title: "Testing"
output: html_document
---

```{r,fig.width = 10,fig.height=10}
#above this is where you can add dimensions
author = c("aaaaaaaaaa", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "t", "u", "v", "w", "x")
Ne = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Me = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
SDe = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Nc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
Mc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)
SDc = c(1, 2, 3, 4, 5, 6, 7, 8, 8, 34, 5, 6, 7, 8, 4, 3, 2, 7, 3, 6, 7, 8, 5)

df = data.frame(author, Ne, Me, SDe, Nc, Mc, SDc)

m.cont <- meta::metacont(n.e = Ne,
                         mean.e = Me,
                         sd.e = SDe,
                         n.c = Nc,
                         mean.c = Mc,
                         sd.c = SDc,
                         studlab = author,
                         data = df,
                         sm = "SMD",
                         method.smd = "Hedges",
                         fixed = FALSE,
                         random = TRUE,
                         method.tau = "REML",
                         hakn = TRUE,
                         title = "Example")

meta::forest.meta(m.cont, 
                  sortvar = TE,
                  predict = TRUE, 
                  print.tau2 = FALSE,
                  leftlabs = c("Author", "g", "SE"),
                  xlim = "symmetric",)

```

当你编织它时,你应该得到: 输出


推荐阅读