Re: [R] R Markdown & chunk extraction in R
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 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 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 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 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 >> > > 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@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@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. __ R-help@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.
Re: [R] R Markdown & chunk extraction in R
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 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 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 > 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 < > sigb...@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@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@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@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.
Re: [R] R Markdown & chunk extraction in R
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 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 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 > > 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@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@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. __ R-help@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.
Re: [R] R Markdown & chunk extraction in R
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 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 > 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@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@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.
Re: [R] R Markdown & chunk extraction in R
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 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@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@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.
[R] R Markdown & chunk extraction in R
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@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.