我有一個二維數據集,我已經繪製在下面。正如箭頭所指出的那樣,我想從數據集中消除兩個實驗性文物。有光澤的應用程序,以消除繪製的實驗性文物
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
嗨對不起,等待示例數據包含在頂部 –