Why is this graph showing up twice in R Markdown? -


```{r scatterplot, fig.width=14, fig.height=14, echo=false, results="hide"}  histogram(   ~factor(     format(df_ian$newdate,"%b"),     levels = c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec")   ) | factor(     format(newdate,"'%y")   ),   data=df_ian, layout=(c(3,6)),   main="flood counts year , month",   ylab="flood count",   xlab="year" ) ``` 

when knit, histogram show twice. missing here?

@hrbrmstr correct, cannot reproduce problem. because of that, cannot advance suspect: plotting histogram every factor of second argument of function.

consider simple dataset:

dt  <- data.frame(gender = rep(c("male", "female"), c(4, 2) ), trans = rep(c("car", "bus", "bike"), c(3, 2, 1) ))  library(lattice) histogram(~trans | gender, data = dt ) 

double hist

lattice functions rely on formula. in example above plot variable trans every level of factor variable gender. how can suppose, gender has 2 levels, male , female, hence have 2 plots.

otherwise, if remove operator |, have single histogram variable trans.

histogram(~trans, data = dt ) 

enter image description here


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -