diff --git a/README.Rmd b/README.Rmd
index 68d9765c..886e9b7d 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -131,16 +131,18 @@ Since `NMscanData` is so general and will figure out where to find
input and output data on its own, let's use the `NMscanMultiple`
wrapper to read multiple models and compare their predictions.
-```{r}
+```{r,NMscanMultiple-plot}
res <- NMscanMultiple(dir=system.file("examples/nonmem", package="NMdata"),
-file.pattern="xgxr.*\\.lst",as.fun="data.table",quiet=TRUE)
+ file.pattern="xgxr.*\\.lst",as.fun="data.table",quiet=TRUE)
gmean <- function(x)exp(mean(log(x)))
res.mean <- res[,.(gmeanPRED=gmean(PRED)),by=.(model,NOMTIME)]
obs.all <- unique(res[,.(ID,NOMTIME,TIME,DV)])
ggplot(res.mean,aes(NOMTIME,gmeanPRED,colour=model))+geom_line()+
- geom_point(aes(TIME,DV),data=obs.all,inherit.aes=FALSE)+
+ geom_point(aes(TIME,DV),data=obs.all[!is.na(DV)],inherit.aes=FALSE)+
scale_y_log10()+
- labs(x="Time",y="Concentration",subtitle="Comparison of population predictions")
+ labs(x="Time",y="Concentration",subtitle="Comparison of population predictions")+
+ theme_bw()+
+ theme(legend.position="bottom")
```
diff --git a/README.md b/README.md
index 45cac84e..a4002997 100644
--- a/README.md
+++ b/README.md
@@ -158,22 +158,24 @@ read multiple models and compare their predictions.
``` r
res <- NMscanMultiple(dir=system.file("examples/nonmem", package="NMdata"),
-file.pattern="xgxr.*\\.lst",as.fun="data.table",quiet=TRUE)
+ file.pattern="xgxr.*\\.lst",as.fun="data.table",quiet=TRUE)
#> $DATA section extracted
#> Based on that, data files related to this file were expected:
gmean <- function(x)exp(mean(log(x)))
res.mean <- res[,.(gmeanPRED=gmean(PRED)),by=.(model,NOMTIME)]
obs.all <- unique(res[,.(ID,NOMTIME,TIME,DV)])
ggplot(res.mean,aes(NOMTIME,gmeanPRED,colour=model))+geom_line()+
- geom_point(aes(TIME,DV),data=obs.all,inherit.aes=FALSE)+
+ geom_point(aes(TIME,DV),data=obs.all[!is.na(DV)],inherit.aes=FALSE)+
scale_y_log10()+
- labs(x="Time",y="Concentration",subtitle="Comparison of population predictions")
+ labs(x="Time",y="Concentration",subtitle="Comparison of population predictions")+
+ theme_bw()+
+ theme(legend.position="bottom")
#> Warning: Transformation introduced infinite values in continuous y-axis
#> Warning: Transformation introduced infinite values in continuous y-axis
```
-
+
## Get the most recent version
diff --git a/man/figures/README-NMscanMultiple-plot-1.png b/man/figures/README-NMscanMultiple-plot-1.png
new file mode 100644
index 00000000..292a6005
Binary files /dev/null and b/man/figures/README-NMscanMultiple-plot-1.png differ