将增强版串音包与串扰软件包一起使用时出现错误“非数字”

问题描述 投票:1回答:1

我想在表格和绘图之间实现双向交互功能:

  1. 选择表中将在绘图中反映的行
  2. 选择图中将显示在表中的点。与here相同。

我设法实现了一个脚本,如果我使用ggplot()和表格(两个对象都相互交谈!)进行散点图,则该脚本可以很好地工作。但是,当使用EnhancedVolcano()和表格时,出现以下错误:

Error in EnhancedVolcano(toptable = data_shared, lab = "disp", x = "qsec",  : 
  qsec is not numeric! 

如果将data_shared变量替换为df_orig,则不会引发任何错误,但是对象之间不会发生串扰:(

这是否意味着SharedData$new()无法将数字值识别为数字值?如何解决这个错误?

非常感谢您的帮助。谢谢

玩具示例:

  library(plotly)            # '4.9.1'
  library(DT)                # '0.11'
  library(crosstalk)         # ‘1.0.0’
  library(EnhancedVolcano)   # ‘1.4.0’
  # Input
  data1 = mtcars  #dim(data1)  # 32  11
  data_shared = SharedData$new(data1) #, key = c("qsec", "hp"))
  # df_orig = data_shared$origData()
  # V-Plot
  vp =EnhancedVolcano( toptable = data_shared,
                       lab  = 'disp',
                       x  =  'qsec',
                       y  =  'hp',
                       xlab  ='testX',
                       ylab = 'testY') 
  bscols(
    ggplotly(vp + aes(x= qsec, y= -log10(hp/1000))),
    datatable(data_shared, style="bootstrap", class="compact", width="100%",
              options=list(deferRender=FALSE, dom='t')))

相同脚本,与ggplot()一起使用:

data1 = mtcars  #dim(data1)  # 32  11
data_shared = SharedData$new(data1) 
vp = ggplot(data = data_shared, mapping = aes(qsec, hp)) +
  geom_point()
bscols(
  ggplotly(vp) ,
  datatable(data_shared, style="bootstrap", class="compact", width="100%",
            options=list(deferRender=FALSE, dom='t')))
r shiny plotly bioconductor ggplotly
1个回答
0
投票

[Note:

© www.soinside.com 2019 - 2024. All rights reserved.