# This file gets called from RExcel, to prepare the data
# needed by shiny.
# load library for melting data
library(reshape2)
# transform date information into R compliant dates
mySymptomsData["Date"] <- as.Date(mySymptomsData[,"Date"], "%d.%m.%Y")
# transform data into ggplot compliant format
symptomsData <- melt(mySymptomsData, id.vars = c("Patient", "Date"))
# save data to file to share with the R session that will run shiny
save.image(file="data.Rdata")
# get the working directory
workingDir <- getwd()
# generate script, which contains information to start the shiny server.
script <- paste(
"
# This script is automatically generated by Symptoms.R
# and is not meant to be edited by user.
# load library used for ploting
library(ggplot2)
# set working directory
setwd(\"", workingDir ,"\")
# load data saved from Excel
load(\"data.Rdata\")
#load library shiny for HTML drawing and run shiny
library(shiny)
runApp(launch.browser=TRUE)
"
, sep="")
# save script as Run.R
# Run.R will be called by RExcel process.
writeLines(script, con="Run.R")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.