R 鼠标悬停在屏幕上,生动而闪亮

R 鼠标悬停在屏幕上,生动而闪亮,r,shiny,rstudio,plotly,R,Shiny,Rstudio,Plotly,我有一些精心编写的代码,在RStudio和RPubs中完美地调用鼠标上数据帧的行名称。但当嵌入有光泽的。 基本准则是: require(shiny) require(plotly) Trial <- read.table("http://history.emory.edu/RAVINA/Aozora/Data/Trial.txt", row.names = 1) plot_ly(Trial, x=V1, y=V2, text=rownames(Trial), mode = "markers

我有一些精心编写的代码,在RStudio和RPubs中完美地调用鼠标上数据帧的行名称。但当嵌入有光泽的。 基本准则是:

require(shiny)
require(plotly)
Trial <- read.table("http://history.emory.edu/RAVINA/Aozora/Data/Trial.txt", row.names = 1)
plot_ly(Trial, x=V1, y=V2, text=rownames(Trial), mode = "markers") 
require(闪亮)
要求(详细地)

试用您需要将一些基本的闪亮函数替换为其对应的绘图函数。即
plotOutput
->
plotlyOutput
renderPlot
->
renderpltly
。另外,最后一个
plot(p)
不是您想要返回的:您只想返回
p
(plot对象)

require(闪亮)
要求(详细地)

谢谢你,大卫!这正是我所需要的。如果这回答了你的问题,你应该通过单击向下箭头下的复选标记来“接受”答案。
require(shiny)
require(plotly)
Trial <- read.table("http://history.emory.edu/RAVINA/Aozora/Data/Trial.txt", row.names = 1)

ui <- fluidPage(
  titlePanel("Word Frequency Analysis for Meiji-era Authors"),
      mainPanel(
      plotOutput("plot"),
      dataTableOutput("Print")
    )
  )


server <- function(input, output){


  output$plot<-renderPlot({
    p <- plot_ly(Trial, x=V1, y=V2, text=rownames(Trial), mode = "text")
    plot(p)
  })
  output$Print<-renderDataTable({Trial})



}

shinyApp(ui = ui, server = server)
require(shiny)
require(plotly)
Trial <- read.table("http://history.emory.edu/RAVINA/Aozora/Data/Trial.txt", row.names = 1)

ui <- fluidPage(
  titlePanel("Word Frequency Analysis for Meiji-era Authors"),
  mainPanel(
    plotlyOutput("plot"),
    dataTableOutput("Print")
  )
)


server <- function(input, output){            
  output$plot<-renderPlotly({
    p <- plot_ly(Trial, x=V1, y=V2, text=rownames(Trial), mode = "text")
    #plot(p)
    p
  })
  output$Print<-renderDataTable({Trial})     
}

shinyApp(ui = ui, server = server)