![](/img/trans.png)
[英]Function to create plot and knit to HTML in RMarkdown not working
[英]RMarkdown Error plot rendered but would not knit - noob
问题:Plot 出现在 rmarkdown 但不织。 出现两个错误。 该文件没有其他问题。
解析中的第 239 行错误(文本 = x,scrfile = src):,文本>:4:16:意外','
3: alpha = 0.9, width = 7) + theme_minimal(base_size = 8) + #注意最小主题alpha
4:阿尔法 = 0.9
调用:... -> parse_all -> parse_all.character -> parse
我进行了很多更改以使其正常工作,包括 alpha 并确认代码已正确链接到其依赖项。 我已确保 dplyr 在库中(在对我不起作用的其他解决方案中阅读它)。 我看不到这个问题,因为 plot 在 rstudio 中工作并在 rmarkdown 中显示并且它没有编织
这是 rmarkdown 中链接到错误的块
#next line is line 239
ONE1 <- ggplot(Italy, aes(Date, as.numeric(FirstDosePC))) +
geom_col(fill = "red", alpha = .9, width = 7) + theme_minimal(base_size = 8) +
#Note minimal theme
xlab(NULL) + ylab(NULL) + scale_x_date(date_labels = "%Y/%m/%d")
OneTwo <- ONE1 + geom_col(data=Ireland, aes(Date,
as.numeric(FirstDosePC)),
fill="Green", alpha = .9,width = 5)
OneTwoThree <- OneTwo + geom_col(data=Latvia, aes(Date,
as.numeric(FirstDosePC)),
fill="black", alpha = .9, width = 2)
OneTwoThree + labs(title="Ireland, Italy, & Latvia - First Dose comparision",
subtitle="ITALY = RED, IRELAND = GREEN, LATVIA = BLACK",
caption = "(ECDC, 2021)",
x="Date Administered",
y="% Population treated")
菜鸟错误。 我在块的第一部分有一条评论,它允许在 rmarkdown 和 r 工作区中构建 plot。
但是评论#正在停止编织过程。
删除评论 - 编织发生(删除 #Note 最小主题...以帮助您查看解决方案)
前
ONE1 <- ggplot(Italy, aes(Date, as.numeric(FirstDosePC))) +
geom_col(fill = "red", alpha = .9, width = 7) + theme_minimal(base_size = 8) +
#Note minimal theme
xlab(NULL) + ylab(NULL) + scale_x_date(date_labels = "%Y/%m/%d")
后
ONE1 <- ggplot(Italy, aes(Date, as.numeric(FirstDosePC))) +
geom_col(fill = "red", alpha = .9, width = 7) + theme_minimal(base_size = 8) +
xlab(NULL) + ylab(NULL) + scale_x_date(date_labels = "%Y/%m/%d")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.