Plot missing in HTML

10 views
Skip to first unread message

Angela Rodrigues Afonso

unread,
Jan 27, 2017, 2:49:49 PM1/27/17
to knitr
Sorry, I made a typo on the last code. 
here's the corrected one:

I've been working on a HTML document with Rmarkdown.

The document has several sp plots and ggplots and all of them appear in the HTML.

But when I call plotK (which is a function from stpp package to plot the spatio-temporal inhomogeneous k-funtion - STIKhat), the plot doesnt appear in the HTML.

Here's a reproducible example for Rmarkdown:


title: "Untitled"
output: html_document
---

```{r}
library(stpp)
data(fmd)
data(northcumbria)
FMD<-as.3dpoints(fmd[,1]/1000,fmd[,2]/1000,fmd[,3])
Northcumbria=northcumbria/1000
# estimation of the temporal intensity
Mt<-density(FMD[,3],n=1000)
mut<-Mt$y[findInterval(FMD[,3],Mt$x)]*dim(FMD)[1]
# estimation of the spatial intensity
h<-mse2d(as.points(FMD[,1:2]), Northcumbria, nsmse=50, range=4)
h<-h$h[which.min(h$mse)]
Ms<-kernel2d(as.points(FMD[,1:2]), Northcumbria, h, nx=5000, ny=5000)
atx<-findInterval(x=FMD[,1],vec=Ms$x)
aty<-findInterval(x=FMD[,2],vec=Ms$y)
mhat<-NULL
for(i in 1:length(atx)) mhat<-c(mhat,Ms$z[atx[i],aty[i]])
# estimation of the STIK function
u <- seq(0,10,by=1)
v <- seq(0,15,by=1)
stik1 <- STIKhat(xyt=FMD, s.region=northcumbria/1000,t.region=c(1,200),
                 lambda=mhat*mut/dim(FMD)[1], dist=u, times=v, infectious=TRUE)
```

```{r}
plotK(stik1)
```

After knitting, the plot still doenst appear in the HTML file. Any ideas on this will be greatly appreciated !
Thanks in advance
Reply all
Reply to author
Forward
0 new messages