Skip to content

Instantly share code, notes, and snippets.

@marcionicolau
Created January 16, 2013 12:27
Show Gist options
  • Select an option

  • Save marcionicolau/4546801 to your computer and use it in GitHub Desktop.

Select an option

Save marcionicolau/4546801 to your computer and use it in GitHub Desktop.
<script src="https://github.com/livereload/livereload-js/raw/master/dist/livereload.js?host=localhost"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="http://aleph.sagemath.org/static/jquery.min.js"></script>
<script src="http://aleph.sagemath.org/static/embedded_sagecell.js"></script>
<script>
$(function () {
sagecell.makeSagecell({inputLocation: 'div.compute-r',
evalButtonText: 'Evaluate',
defaultLanguage: "r",
languages: sagecell.allLanguages});
});
</script>
<div class="compute-r"><script type="text/x-sage">
x <- 3; x <- x + 3
print(x)
</script></div>
library(shiny)
shinyServer(function(input, output) {
output$Routput=reactivePrint(function(){
cat(input$code,"\n")
eval(parse(text = input$code))
})
})
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Basic notebook"),
sidebarPanel(helpText("Include button to add input and output fields")),
mainPanel(
includeHTML('lr.js'), # needed for livereload
tabsetPanel(id = "tabs",
tabPanel("Notebook",textInput("code","Input R-code", value = 'x <- 3; x <- x + 3'), verbatimTextOutput("Routput"), helpText("Add button to evaluate the code and make the return panel conditional on the the type of output (e.g., text, plot, table).")),
tabPanel("Sage", includeHTML('sage.js'))
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment