">Could you please send the entire source for your report?"
Sure thing:
library(ggplot2)
library(reshape2)
library(plotly)
library(htmlwidgets)
# this (fix Pandoc error)
Sys.setenv(RSTUDIO_PANDOC='C:/Program Files (x86)/Pandoc')
run<-as.data.frame(labkey.data)
#print(head(run))
data<-run[c(1,50,8:48)]
colnames(data)[colnames(data) == "specimenid"] <- "Name"
#print(dim(data))
#print(reshape2::melt(data$Name))
data<-aggregate(data[c(2:42)], list(data$Name), mean)
rownames(data) <- data$Group.1
data_melt<-reshape2::melt(data)
colnames(data_melt)[colnames(data_melt) == "Group.1"] <- "Condition"
colnames(data_melt)[colnames(data_melt) == "variable"] <- "Analyte"
# Create heatmap with ggplot2
ggp <- ggplot(data_melt, aes(Condition, Analyte)) +
geom_tile(aes(fill = value)) +
theme(axis.text.x = element_text(
angle = 90,
size=6)) +
scale_x_discrete(breaks = data_melt$Condition)
# Save ggplotly as widget in file test.html - fails ... permission?
#saveWidget(ggplotly(ggp), file = paste(labkey.url.base, labkey.url.path, "test.html", sep=''))
# report doesn't show - now I get "Failed to retrieve report results"
# "output.html" saved to temp and is desired interactive plotly
#saveWidget(ggplotly(ggp), file = "test.html")
#rawHTML <- paste(readLines("test.html"),collapse="\n")
## ${htmlout:output}
#write(rawHTML, file="output")
# "Failed to retrieve report results" writes "output" in temp location,
# looks like html, but wont display in browser
#saveWidget(ggplotly(ggp), file = "output")
## ${htmlout:output}
#write(ggplotly(ggp), file="output")
# works, but not auto-sized, not interactive
ggsave("${imgout:labkeyl_png}",plot=ggp,device="png",width=5, height=8)
">When you saved the file to a temp location, did the interactive heatmap work as you wanted?"
yes, when writing raw HTML
">When using the "saveWidget" did you experience any issues with that function not being found?"
No, but there was a Pandoc error. It was in the system path but wasn't being seen by the report/script
">Are you using the ggplot2 library? or What packages/libraries are you using?"
yes, ggplot2
Disclosure: I am on an older version of labkey (18.2) - my next step was to create an installation with the latest LabKey and test it there. But it'd be helpful to know if you think it should work or not.