Calling R in java-Rcaller

后端 未结 1 849
孤街浪徒
孤街浪徒 2021-01-21 19:50

I am trying to implement clustering using R in java by employing R caller. I am trying to run sample code for clustering validation and I get that common error faced by most of

相关标签:
1条回答
  • 2021-01-21 20:28

    You have some spelling mistakes in you code. like clValid not clvalid , and you miss many quotes like "hierarchical",....

    I think it is better to put your code in a script, and call it from java like this :

    Runtime.getRuntime().exec("Rscript myScript.R"); 
    

    where myScript.R is :

    library(clValid)
    data(mouse)
    express <- mouse [,c('M1','M2','M3','NC1','NC2','NC3')]
    rownames (express) <- mouse$ID 
    intern <- clValid(express, 2:6 , clMethods = c( 'hierarchical','kmeans',
                                                   'diana','clara','model') ,
                                                    validation = 'internal')
    b <- summary(intern) 
    
    0 讨论(0)
提交回复
热议问题