q.template <- function(type='simple', edit=FALSE)
{
template.simple <- '---
title: "%s"
output: html_document
params:
jid: 1
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
require(qrmarkdown)
myparam <- jid.params(params$jid)
```
```{r script_main}
%s
```
'
template.chain <- "---
title: 'Nested Job'
output: html_document
params:
jid: 1
---
Date: `r Sys.Date()` JID: `r params$jid`
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Dynamic Call Flow
we kick off new job process inside of job
```{r test_nested_case }
message('we are queueing new job inside!')
Sys.setenv(QWD='/Users/chriso/Documents/Code/Rlib/qrmarkdown/log')
require(qrmarkdown)
dox <- function(x)
{
return( q.push(script = 'tests/myTest.Rmd') )
}
new.job <- lapply(1:3, dox) # queue 3 sub process from this job
q.wait(unlist(new.job))
```
"
# selection
RET <- NULL
switch(type,
'simple' = { RET <- template.simple},
'chain' = { RET <-template.chain}
)
if(edit)
{
rstudioapi::documentNew(RET,type='rmarkdown')
} else
return(RET)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.