How to use child and plot properly following the reference exemple

I have tried to generalize the exemple given here :
in order to get a document whith a list of graphics for each column of mtcars data set.

So, I replaced the chunk in the child file

lm(mpg ~ ., data = mtcars[, c("mpg", x)])
plot(mtcars[ x ])
And knit the file, like the original example :

res <- lapply(names(mtcars),function (x) {
knitr::knit_child('DocumentCHILD.Rmd', envir = environment(), quiet = TRUE)
cat(unlist(res), sep = '\n')

It gives the following with no grapics at all ! The unnamed-chunk *.png files don't exist after "kniting" the master file.
Regression on "mpg"
img src="DocumentMASTER_files/figure-html/unnamed-chunk-5-1.png" width="672"
Regression on "cyl"
img src="DocumentMASTER_files/figure-html/unnamed-chunk-8-1.png" width="672"
... until on "carb".

What is the solution to have a nice succession of graphics by iteration on the list of mtcars column names?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.