Skip to content

Instantly share code, notes, and snippets.

@aammd
Created April 15, 2015 06:32
Show Gist options
  • Save aammd/7f4825b686b2e50435a8 to your computer and use it in GitHub Desktop.
Save aammd/7f4825b686b2e50435a8 to your computer and use it in GitHub Desktop.
print_num <- function(num){
print(num)
}
print_num_x <- function(num = x){
print(num)
}
sources:
- rando.R
targets:
all:
depends:
- randum_num.md
x:
command: assign(I("x"), 42)
randum_num.md:
depends: x
knitr: true
```{r, eval=FALSE}
source("rando.R")
x <- 42
```
i like numbers. `r print_num(5)` is a number
another number i like is `r x`.
Here is another number: `r print_num(x)`
That works fine. the object `x` is available within inline code chunks.
What happens if it is set as a default arguement?
in a code chunk
```{r}
print_num_x()
```
the same is true for an inline code, but why break something twice?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment