If I previously defined
n <- 200 maf <- .2
Is there any way to echo
snp <- rbinom(n,2,maf)
so that it displays as
snp <- rbinom(200,2,.2)
in the resulting knitr document.
You can use substitute as follows:
substitute
```{r ,echo=FALSE} substitute(snp <- rbinom(n,2,maf),list(n=n,maf=maf)) rbinom(n,2,maf) ``` ## snp <- rbinom(200, 2, 0.2) ## [1] 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 2 0 1 1 2 1 0 0 0 0 ## [36] 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 ## [71] 0 1 0 0 0 0 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 2 0 1 0 1 1 0 1 0 0 ## [106] 1 1 0 1 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ## [141] 1 0 0 1 0 0 1 0 2 0 0 0 1 0 0 0 1 1 0 0 0 0 0 2 1 1 2 0 1 0 0 0 0 0 1 ## [176] 0 0 2 0 1 1 0 0 0 0 0 1 0 1 2 0 1 1 2 0 0 1 1 1 0
Source: https://habr.com/ru/post/948264/More articles:angularjs ui-sortable: cannot call methods when sorting before initialization; tried calling the 'refresh' method - javascriptmatplotlib colors rgb_to_hsv does not work correctly. Maybe you need to report this? - pythonpython raise KeyError message with color - pythonHow to get the sum of keys of an array of objects in underscore.js? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/948263/force-margins-to-collapse-on-floating-elements&usg=ALkJrhgVpErq9WJUjJjt1JFqKRkNieeY3QDetermine how many (optional) arguments that are actually passed to the VBA function? - vbaHow to guess the Scala / Akka / Play project? - scalaBootstrap and font-awesome in MVC4 - twitter-bootstrap"Non-progressive address" with exim4 - eximMouse scrolling in sticky notes Windows - windowsAll Articles