vendredi 1 juin 2018

Call R variable in Javascript chunk (in Rstudio)

I am trying to call an R variable in JS chunk, but JS did not recognize it. I think it is normal since R and JS run in different contexts.

I tried to save the R variable into a text file and then I tried to load it to JS but is seems like it did not recognize it neither. Here is the JS code i used to read my R variable which is stored in txt file :

    $.get("./inter.txt", function(data) {
    var k = data;
     });     

I tried different alternatives ("./inter.txt", "/inter.txt", "inter.txt","mypath/inter.txt") The text file is in the same folder as my R project. I code in R but I am new to javascript.

Any idea guys ?




Aucun commentaire:

Enregistrer un commentaire