0

我无法使用 highcharter 在 R 中创建交互式柱形图。这是我正在尝试使用的代码:

library(highcharter)
library(shiny)
library(shinydashboard)
library(extrafontdb)
testdata<-read.table("Matrix_Mean_sym.txt", header=TRUE)
testdata2<-t(testdata)
testdatase<-read.table("Matrix_SE_sym.txt", header=TRUE)
testdatase2<-t(testdatase)

ui<-dashboardPage(...
tabItem(tabName = "graph",
                           fluidRow(
                             box(title= "Gene Selection",
                                 selectizeInput(inputId = "gene", "Gene Symbol:", 
                                                choices = colnames(testdata2), 
                                                selected="CD8A", 
                                                options = NULL,
                                                multiple = FALSE)),
                             box(title= "Graph of Gene Expression",
                                 highchartOutput("genePlot"))
                           ))
server<- function(input, output) {
  output$genePlot <- {
   renderHighchart({
    require(input$gene)
  highchart() %>%
    hc_add_series(data = list(testdata2[, input$gene]), type="column") %>%
    hc_xAxis(categories = c('CD14+', 
                            'CD19+',
                            'CD4+',
                            'CD56+',
                            'CD8+',
                            'Neutrophils',
                            'nRBCs',
                            'WB')) %>%
    hc_title(text= "Graph of Gene Expression")      
})}

我知道我没有提供工作数据集,但这是来自 140904 元素矩阵。每次运行此代码时出现的错误是:
if (!loaded) { 中的警告:条件的长度 > 1 并且仅使用第一个元素 c("Loading required package: $", "Loading required package : input", "Loading required package: gene") 失败并出现错误:''package' must be of length 1' asJSON(keep_vec_names=TRUE) 的输入是一个命名向量。在 jsonlite 的未来版本中,将不支持此选项,命名向量将被转换为数组而不是对象。如果您想要 JSON 对象输出,请改用命名列表。请参阅 ?toJSON。
任何帮助,将不胜感激。谢谢!

4

0 回答 0