Reputation: 455
I built a rmarkdown code that connects to teradata that fetches required data into dataframes. Using these dataframe i am running proportion tests at the bottom of the code to get final output result. I am trying to push this final output result to top of the HTML output file. Below is a dummy code that is representative of my actual piece of code.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r setup, include=FALSE}
Fetches data from Teradata into a dataframe called ABC
```
```{r setup, include=FALSE}
proprotion test on ABC. Results saved in a table called DEF.
```
print(DEF)
When I look at my HTML output file I have to scroll down to bottom of page to look at results. As of now I found a work around using explicit hyperlinks that will navigate to desired point in the output file.
Upvotes: 2
Views: 547
Reputation: 19867
You can use the ref.label
chunk option to call a chunk before it is actually evaluated. Here, the first chunk will print the result of the last chunk:
```{r lab2, ref.label="result"}
```
```{r setup}
# some setup code
```
```{r result, echo=FALSE, results='hide'}
1+1
```
Upvotes: 3