I'm trying to plot using Knitr in Lyx. When I run
<<>>=
install.packages("ggplot2")
library(ggplot2)
qplot(y=y, x=1:1000, main = 'Log-Likelihood')
@
I get the error
LaTeX Error: File `figure/unnamed-chunk-6.eps.bb' not found.
I've tried including extensions in the starting brackets, but with no success. How do I get my plot?
Following the first answer, tried this:
Defining function (not that important, just to show how I get y)
<<>>=
exp.loglik <- function(lambda, obs){
xbar = mean(obs)
return(length(obs)*log(lambda)-lambda*xbar)
}
@
Defining y (not that important, but just including to show how y is defined)
<<>>=
y = rep(NA,1000)
for (i in 1:1000){
y[i] = exp.loglik(lambda=i/10000, obs=diet_data$survtime)
}
@
Code that runs and then the error occurs (note that I installed the package in pure R as instructed)
<<warning=FALSE, message=FALSE, echo=FALSE>>=
library(ggplot2)
qplot(y=y, x=1:1000, main = 'Log-Likelihood')
@
Same ERROR: LaTeX Error: File `figure/unnamed-chunk-6.eps.bb' not found.