How to call an R script from within a JS code

LabKey Support Forum (Inactive)
How to call an R script from within a JS code Ben Bimber  2012-05-01 19:10
Status: Closed
 
Hi Leo,

Here's a similar example you can adapt. You'll use a Report webpart. The partConfig section is where you pass config to the R report.


            new LABKEY.WebPart({
                partName: 'Report',
                renderTo: 'myDiv',
        //these are passed on the URL to your script
                partConfig: {
                    title: 'Population Change',
                    schemaName: 'study',
                    showSection: 'barchart&tsvfile',
                    reportId : 'module:ehr/schemas/study/colonyPopulationChange/Bar Chart.r',
                    'query.queryName': 'colonyPopulationChange',
                    'query.Id/dataset/demographics/species~neq': 'Unknown'
                },
                failure: function(error){
            alert('there was an error');
        },
        success: function(response){
                console.log(arguments);
        },
                scope: this
            }.render();