Does anyone have the experience of passing variables from “RChunk” to Javascript or CSS ?

Does anyone have the experience of passing variables from “RChunk” to Javascript or CSS ?

We are building an e-learning service for R language with learnr package and RStudio Connect. There is a variable in “RChunk” of RMarkdown. And we would like to use this variable to decide if learnr “Hint” component is visible or invisible.

We have found a solution of making “Hint” component invisible without passing variable from R:

<div id="pkgload-hint" style="display:none">

**Hint:** library()

</div>

This way can hide the learnr Hint without variable.

Because we would like to use variable which depend on the data from our database, we edited the codes as follows:

<div id="pkgload-hint" style=T3>

*T3=”display:none” or “” (depends on Database)

But it doesn’t work.

Is there any suggestion to pass the variable from “Rchunk” to Javascript or CSS ?

Many Thanks,

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.