[R] R Markdown & chunk extraction in R

Yihui Xie x|e @end|ng |rom y|hu|@n@me
Wed Apr 8 21:45:42 CEST 2020


Hi Ashim,

read_chunk() can only read R scripts.

Regards,
Yihui
--
https://yihui.org

On Wed, Apr 8, 2020 at 10:24 AM Ashim Kapoor <ashimkapoor using gmail.com> wrote:
>
> 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 using 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 using 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 using 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 using 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 using 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 using 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.



More information about the R-help mailing list