This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
devtools::install_github("timelyportfolio/sunburstR")
## Error in get(genname, envir = envir) : object 'testthat_print' not found
## Skipping install of 'sunburstR' from a github remote, the SHA1 (9f474397) has not changed since last install.
## Use `force = TRUE` to force installation
library(sunburstR)
# read in sample visit-sequences.csv data provided in source
# https://gist.github.com/kerryrodden/7090426#file-visit-sequences-csv
# make 1st orange and all others green
# use color names instead of HEX
colors2 <- list(
domain=unique(unlist(strsplit(Book8$V1,"-"))))
colors2 = as.data.frame(colors2)
colors2$range = colors2$domain
for(i in 1:nrow(colors2))
{
if(colors2$range[i] == "normal")
{
colors2$range[i]= "#6bacb2"
}
else if(colors2$range[i] == "warning")
{
colors2$range[i]= "#f09034"
}
else if(colors2$range[i] == "urgent")
{
colors2$range[i]= "#dc324a"
}
else if(colors2$range[i] == "quality")
{
colors2$range[i]= "blue"
}
else if(colors2$range[i] == "palpitations")
{
colors2$range[i]= "#9300ff"
}
else if(colors2$range[i] == "no_symptoms")
{
colors2$range[i]= "white"
}
else if(colors2$range[i] == "fatigue")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "shortness_of_breath")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "lightheaded")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "other")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "confused")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "chest_pains")
{
colors2$range[i]= "#f0ceff"
}
else if(colors2$range[i] == "1")
{
colors2$range[i]= "white"
}
else if(colors2$range[i] == "2")
{
colors2$range[i]= "#FFFFD4"
}
else if(colors2$range[i] == "3")
{
colors2$range[i]= "#FEE391"
}
else if(colors2$range[i] == "4")
{
colors2$range[i]= "#FEC44F"
}
else if(colors2$range[i] == "5")
{
colors2$range[i]= "#D95F0E"
}
else
{
colors2$range[i]="NA"
}
}
colors2 = as.list(colors2)
sunburst(Book8, colors=colors2)
You can also embed plots, for example: