我有一个二维数据集,我已经绘制在下面。正如箭头所指出的那样,我想从数据集中消除两个实验性文物。有光泽的应用程序,以消除绘制的实验性文物
head(df)
data CTCF
1 -20000 0.9220779
2 -19999 0.9220779
3 -19998 0.9350649
4 -19997 0.9350649
5 -19996 0.9220779
6 -19995 0.9220779
我从发亮库揭示在所述数据集的点击的点的x和y轴上的位置所取的有光泽的应用程式。
library(shiny)
ui <- basicPage(
plotOutput("plot1", click = "plot_click"),
verbatimTextOutput("info")
)
server <- function(input, output) {
output$plot1 <- renderPlot({
plot(df[,1], df[,2])
})
output$info <- renderText({
paste0("x=", input$plot_click$x, "\ny=", input$plot_click$y)
})
}
shinyApp(ui, server)
的文物在哪里,但我宁愿能够操纵在那些位置数据摆脱文物这是恰好识别有用的。
有没有人知道如何操作数据后,它已被点击图上?我希望能够点击出现伪像的区域,以便将它们反应性地设置为平均值y轴值。更妙的是这将是冷静,如果你可以点击并拖动一个区域,而不是单独点击点......
UPDATE 我曾尝试以下:
library(shiny)
ui <- basicPage(
plotOutput("plot1", click = "plot_click"),
tableOutput("tab")
)
server <- function(input, output) {
output$plot1 <- renderPlot({
plot(df[,1], df[,2])
})
output$info<-renderText({class(as.numeric(input$plot_click$x))})
data_new<-eventReactive(input$plot_click,{
data=df
data[round(as.numeric(input$plot_click$x)), 2]=mean(data[,2])
data
})
output$tab<-renderTable({data_new()})
}
shinyApp(ui, server)
但输出替换与平均值而整列不仅仅是更换点击的位置
data CTCF
-20000 0.71 #average of entire column
-19999 0.71
-19998 0.71
-19997 0.71
-19996 0.71
而且我不知道有足够的了解闪亮在如何处理对象能够解决这一问题方面.... 感谢
你能分享一个样本数据吗? – SBista
嗨对不起,等待示例数据包含在顶部 –