Comments (5)
Please take a closer look at that example. In particular, I only have one argument in knit_child()
. Note you have to use the latest version of knitr
as well.
from knitr-examples.
Hi Yihui, I did take a closer look and found the following:
Without externalizig the R code the md example works ok.
I can run the example and gives me expected results in markdown.
But if i externalize te R code and read it with 'read_chunk' results are like:
Collect results from the template for each i and write them back later.
read_chunk("020-for-loop-run-all.R")
\section{Now i is \Sexpr{i}}
<<>>= print(i) iris[i, ] @
\section{Now i is \Sexpr{i}}
<<>>= print(i) iris[i, ] @
\section{Now i is \Sexpr{i}}
<<>>= print(i) iris[i, ] @
These seem Latex like to me?
Does knitr_child do latex by default?
Please advise.
from knitr-examples.
No, knit_child()
simply follows the syntax of the parent document. It does not use LaTeX by default.
If you want to use Markdown, you should use Markdown for both the parent document and the template. You are not supposed to use the Rnw/LaTeX syntax <<>>=
.
I have no idea about your 020-for-loop-run-all.R
. Please post a complete example if possible.
from knitr-examples.
Hi Yihui,
thank you for your time, indeed the issue was that in the externalized R script I forgot to replace the Rnw with the Rmd. Now I added two chunks one for latex and one for markdown and all works well.
Sorry for my sloppyness, I should have seen this before posting.
hugo
## @knitr run-all-lx
out = NULL
for (i in 1:3) {
out = c(out, knit_child('020-for-template.Rnw'))
}
## @knitr run-all-md
out = NULL
for (i in 1:3) {
out = c(out, knit_child('020-for-template.Rmd'))
}
from knitr-examples.
No problem.
from knitr-examples.
Related Issues (20)
- While using the Python Engine, can I create and embed plots in my document? HOT 3
- Zero-width space in 065-rmd-chunk.Rmd HOT 3
- No kable output in nested for loops HOT 6
- Golang example HOT 19
- engine bash not work on windows OS HOT 7
- Messages with false appendLF still gets seperated HOT 1
- knit.exit() for only this chunk
- Issues with commenting on code lines appearing in compiled PDF HOT 2
- Writing up a knitr document in windows but opening up in linux
- Issues in knitting on ggplots
- haskell engine error
- knitr syntax HOT 2
- Integration tests still valid ? HOT 2
- rgl update on CRAN seems to have modified the rgl example
- Recreate a mechanism to check knitr PR on a branch of knitr-examples HOT 1
- Add a GHA workflow to trigger a new check in knitr repo ? HOT 1
- Add a function in knitr to run example
- Fix issue with example 058 HOT 2
- Quarto PDF HOT 2
- Modifying powerpoint templates on Windows results on corrupt pptx file, aka "Powerpoint found a problem" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knitr-examples.