Is there a way to knit multiple HTML documents by chunk within one Rscript?

77 Views Asked by At

Is there a way to knit only certain chunks into a HTML document?

Say I'm doing analysis on 3 different cell markers, can I tell R to start knitting at the beginning of Marker1 and stop knitting at the end of Marker 1, then start knitting at Marker 2 etc to ultimately create 3 HTML files?

The only way I can think to do this is split my analysis into multiple Rscript files but I really don't want to do that.

dput(mtcars)

#Start knit1
#+
model1 <- lm(mpg ~ cyl, data = mtcars)
summary(model1)
#End knit1

#Start knit2
#+
model2 <- lm(mpg ~ hp, data = mtcars)
summary(model2)
#End knit2

#Start knit3
#+
model3 <- lm(mpg ~ disp, data = mtcars)
summary(model2)
#End knit3

Thank you for your help!

0

There are 0 best solutions below