4

I have an Rmd file which interacts with a number of scripts and variables. In these scripts, there is a section where I want to provide a link. That link address is field in a data frame. What I am trying to do is something like the following:

[Click to Visit Report] (`r as.character(ModelAttributes[1,"ReportLink"])`)

However, the URL component of the markdown does not want to recognize the code chunk inside it.

Any ideas?

jamesknix
  • 43
  • 4

1 Answers1

3

Use the following code in the file file.Rmd

```{r}
df <- data.frame(a = c(1, 2), 
             url = c("http://google.com", "https://github.com"), 
             stringsAsFactors = FALSE)
```

[Click to Visit Report](`r df[1, "url"]`)

Here's the result (clicking the link works)

enter image description here

Andrew Brēza
  • 7,705
  • 3
  • 34
  • 40
sckott
  • 5,755
  • 2
  • 26
  • 42