Dear Sigbert, Also see this :- https://www.rdocumentation.org/packages/knitr/versions/1.28/topics/knit_code Best, Ashim On Wed, Apr 8, 2020 at 1:13 PM Ashim Kapoor <ashimkapoor at gmail.com> wrote:> Dear Sigbert, > > Please see this. > > https://bookdown.org/yihui/rmarkdown-cookbook/purl.html > > Best, > Ashim > > On Wed, Apr 8, 2020 at 1:02 PM Sigbert Klinke <sigbert at wiwi.hu-berlin.de> > wrote: > >> Hi, >> >> exists a possibility to extract chunks from a R Markdown file and to >> return them as (named) list in R? >> >> Thanks Sigbert >> >> -- >> https://hu.berlin/sk >> https://hu.berlin/mmstat3 >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >[[alternative HTML version deleted]]
And please note that knitr::knit_code$get() only works (i.e. returns a named list of code chunks) inside a knitr document when the document _is being knitted_. It doesn't work outside the document. Ideally, you should use the document parser of knitr, but it is not exported. Regards, Yihui -- https://yihui.org On Wed, Apr 8, 2020 at 2:54 AM Ashim Kapoor <ashimkapoor at gmail.com> wrote:> > Dear Sigbert, > > Also see this :- > > https://www.rdocumentation.org/packages/knitr/versions/1.28/topics/knit_code > > Best, > Ashim > > On Wed, Apr 8, 2020 at 1:13 PM Ashim Kapoor <ashimkapoor at gmail.com> wrote: > > > Dear Sigbert, > > > > Please see this. > > > > https://bookdown.org/yihui/rmarkdown-cookbook/purl.html > > > > Best, > > Ashim > > > > On Wed, Apr 8, 2020 at 1:02 PM Sigbert Klinke <sigbert at wiwi.hu-berlin.de> > > wrote: > > > >> Hi, > >> > >> exists a possibility to extract chunks from a R Markdown file and to > >> return them as (named) list in R? > >> > >> Thanks Sigbert > >> > >> -- > >> https://hu.berlin/sk > >> https://hu.berlin/mmstat3 > >> > >> ______________________________________________ > >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > >> > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Dear Yihui, Can we not 1st use read_chunk to import an Rmd and then do knit_code()$get ? I could be mistaken. Please correct me if I am wrong. Best, Ashim On Wed, Apr 8, 2020 at 8:47 PM Yihui Xie <xie at yihui.name> wrote:> And please note that knitr::knit_code$get() only works (i.e. returns a > named list of code chunks) inside a knitr document when the document > _is being knitted_. It doesn't work outside the document. Ideally, you > should use the document parser of knitr, but it is not exported. > > Regards, > Yihui > -- > https://yihui.org > > On Wed, Apr 8, 2020 at 2:54 AM Ashim Kapoor <ashimkapoor at gmail.com> wrote: > > > > Dear Sigbert, > > > > Also see this :- > > > > > https://www.rdocumentation.org/packages/knitr/versions/1.28/topics/knit_code > > > > Best, > > Ashim > > > > On Wed, Apr 8, 2020 at 1:13 PM Ashim Kapoor <ashimkapoor at gmail.com> > wrote: > > > > > Dear Sigbert, > > > > > > Please see this. > > > > > > https://bookdown.org/yihui/rmarkdown-cookbook/purl.html > > > > > > Best, > > > Ashim > > > > > > On Wed, Apr 8, 2020 at 1:02 PM Sigbert Klinke < > sigbert at wiwi.hu-berlin.de> > > > wrote: > > > > > >> Hi, > > >> > > >> exists a possibility to extract chunks from a R Markdown file and to > > >> return them as (named) list in R? > > >> > > >> Thanks Sigbert > > >> > > >> -- > > >> https://hu.berlin/sk > > >> https://hu.berlin/mmstat3 > > >> > > >> ______________________________________________ > > >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > >> https://stat.ethz.ch/mailman/listinfo/r-help > > >> PLEASE do read the posting guide > > >> http://www.R-project.org/posting-guide.html > > >> and provide commented, minimal, self-contained, reproducible code. > > >> > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]