首页 > 解决方案 > 条形图代码有效,但在尝试编织到 flexdashboard 或 rnotebook 时会导致错误

问题描述

这是我尝试编织到 flexdashboard/rnotebook 时收到的错误:

match.arg(method) 中的错误:'arg' 必须为 NULL 或字符向量调用:... withVisible -> eval -> ggplot -> filter -> match.arg 执行停止。

title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill


```{r setup, include=FALSE}
library("flexdashboard")
library("ggplot2")
load("K:/Research/Jamie/R/#6/stl7172.Rda")```


Column {data-width=333}
-----------------------------------------------------------------------

### Chart A

```{r}
ggplot(data= filter(stl7172, SEX == "Male" | SEX == "Female", stl7172$MET2013 == "STL_MSA"),
         aes(x = SEX, y = INCTOT, fill = RACE)) +  
  geom_bar(stat = "summary", position= position_dodge(), width = .9) +
  labs(                                            
    title="Mean Income Level for Workers in the Leisure & Hospitality Industry",
    subtitle= "(St. Louis MSA, by race and sex)",
    caption = "(Source: IPUMS)")

标签: rggplot2

解决方案


推荐阅读