Output in Julia Escher.jl in web very plain


Output in Julia Escher.jl in web very plain



So, I have this code r.jl and I am fully newbie to this and this is only a school projects, yes it suppose to be easy using shiny in r, but my professor doesn't want something simple:


r.jl


using RCall
using ImageView, Images

R"library(NLP)"
R"library(RColorBrewer)"
R"library(tm)"
R"library(SnowballC)"
R"library(e1071)"
R"library(gplots)"
R"library(ROCR)"
R"library(gmodels)"
R"library(caret)"
R"library(xtable)"
R"sms_raw <- read.csv('/home/r/sms_spam.csv', stringsAsFactors = FALSE)"
R"str(sms_raw)"
R"summary(sms_raw)"
R"sms_raw$type <- factor(sms_raw$type)"

R"sms_results <- read.csv('/home/r/sms_results.csv')"
R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')"
R"pred <- prediction(predictions = sms_results$prob_spam, labels = sms_results$actual_type)"
R"perf <- performance(pred, measure = 'tpr', x.measure = 'fpr')"

R"plot(perf, main = 'ROC curve for SMS spam filter', col = 'blue', lwd = 2)"



using Compose
using Colors

# define the `sierpinski` triangle function
function sierpinski(n)
if n == 0
compose(context(), polygon([(1,1), (0,1), (1/2, 0)]))
else
t = sierpinski(n - 1)
compose(context(),
(context(1/4, 0, 1/2, 1/2), t),
(context( 0, 1/2, 1/2, 1/2), t),
(context(1/2, 1/2, 1/2, 1/2), t))
end
end

main(window) = compose(sierpinski(6))

function main(window)
# load assets
push!(window.assets, "layout2")
push!(window.assets, "tex")

# create the tabs
tabbar = tabs([
hbox("Sierpinski"),
hbox("R"),
hbox("R"),
hbox("R"),
hbox("R"),
hbox("R"),
hbox("R"),

])

# create the pages
tabcontent = pages([
sierpinski(5),
R"str(sms_raw)",
R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')",
R"png('rplot.png')",
image("/root/.julia/v0.4/Escher/examples/myplot.png"),
tex("Help Me"),
title(3, "T "),


])

# connect the tabs to pages
# returns a pair of "connected" tab set and pages
t, p = wire(tabbar, tabcontent, :tab_channel, :selected)

# stack them on top of each other
vbox(t, p)
end



So I use julia with Escher.jl and embed R and then the output in web like this



Way too plain image



The output is weird. Not like in Rstudio like this:



Output that easier and right



Help Me, I don't understand what I am doing, I just want static web output with R (and I am forbidden to use Rook, or other things like shiny) but to be embed in others things. My Professor is so complicated



So I'm using Escher.jl and RCall.jl





What about trying to println the R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')"?
– ShaoWei Teo
May 27 '16 at 1:44



println


R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')"





so printlnR"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')"
– Davin Dirgantara
May 27 '16 at 2:10



printlnR"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')"





still cant @ShaoWeiTeo . other ? but thank you, and the output now is nothing....
– Davin Dirgantara
May 27 '16 at 2:28






Sorry that was a bad try... what about using the rcopy function in RCall.jl? The function is exported, so you can just use rcopy(R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')")...
– ShaoWei Teo
May 27 '16 at 5:05


rcopy


RCall.jl


rcopy(R"confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = 'spam')")





Hmm? You are using the image in your local folder. You will need to read it in first using the imread function from the Images.jl package. Instruction can be found here: escher-jl.org/content-api.html
– ShaoWei Teo
May 31 '16 at 6:29


imread


Images.jl









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

Moria Casán

How to make file upload 'Required' in Contact Form 7?