R Markdown Flexdashboard-Ramchart和HighCharter-显示问题

时间:2018-08-13 09:02:08

标签: r r-markdown amcharts flexdashboard r-highcharter

在R Markdown(flexdashobard)中显示图表时出现问题。我有多页(3)。在R设置中,我加载RData。

何时:

  • 第一个是highcharter包中的图表;
  • 第二个-rpivotTable中的图表;
  • 第三部分-夯图图表

代替第一页和第二页中的图表,我看到了某种代码(看起来像图表选项),在第三页中,所有内容均按原样显示。

在R设置中,我加载了库highcharter(它也已加载到.RData!)中,所有内容均应在第一页和第二页中显示,但我在第三页中看不到任何图表(空白框)。 / p>

何时:

  • 首先-冲压图中的图表;
  • 第二个-rpivotTable中的图表;
  • 第三部分-highcharter的图表

所有内容均应显示。

我在所有使用选项的地方:

{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE} 

您知道我应该使用哪些选项吗?

谢谢!

编辑-示例代码

样本.R代码:

library(rAmCharts)
library(highcharter)
library(rpivotTable)

#ramchart
chart_1 <- amPlot(x=iris$Sepal.Length, y=iris$Sepal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")

chart_2 <- amPlot(x=iris$Sepal.Length, y=iris$Petal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")

chart_3 <- amPlot(x=iris$Petal.Length, y=iris$Petal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")


#pivot
pivot <- rpivotTable(iris, aggregatorName="Sum",  vals="Petal.Length", 
                             cols=c("Species"), rendererName="Line Chart" )

#highcharter
hchart_1 <-
highchart() %>% hc_chart(type = "column")%>%
  hc_xAxis(categories = iris$Species) %>%
  hc_add_series(data = iris$Sepal.Length, name = "Sepallength", color = "yellow", visible = TRUE)

    save.image("iristest.RData")

R.Markdown代码示例:

---
title: iris test
output: 
  flexdashboard::flex_dashboard:
    theme: yeti
    orientation: rows

---


```{r setup, include=FALSE}
load("iristest.RData")
```

highchart
=====================================  

Column {width=700px}
-----------------------------------------------------------------------
### Chart1

```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE} 
### ch1
`hchart_1`
```

Column {width=700px}
-----------------------------------------------------------------------

### ch1
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE,message=FALSE} 
### Chart1
`hchart_1`
```

pivot
=====================================   

Column {width=700px}
-----------------------------------------------------------------------
### pivot

```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE} 
### 
pivot

```


ramchart {data-orientation=columns}
=====================================  
Column {width=700px}
-----------------------------------------------------------------------
### abc

```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE} 
### abc
chart_1

```

### abc

```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE} 
### abc
chart_3
```

0 个答案:

没有答案