Html 如何处理批输入数据并在表中返回输出?

Html 如何处理批输入数据并在表中返回输出?,html,r,shiny,Html,R,Shiny,我是新手。我正在尝试创建一个UI,允许用户批量粘贴数据,对数据进行一些计算,然后将结果作为一个表返回,但我无法让输出表在这里工作 我研究了textinput和shinyTable,最终选择了标签$textarea,因为这允许我批量输入。但我不能用输入数据进行计算,我不知道如何解决这个问题 代码片段 用户界面 服务器.R 如果需要任何信息,请告诉我。感谢您的帮助 source("Assign Module.R") tabPanel("Assign Module", sideba

我是新手。我正在尝试创建一个UI,允许用户批量粘贴数据,对数据进行一些计算,然后将结果作为一个表返回,但我无法让输出表在这里工作

我研究了textinput和shinyTable,最终选择了标签$textarea,因为这允许我批量输入。但我不能用输入数据进行计算,我不知道如何解决这个问题

代码片段

用户界面

服务器.R

如果需要任何信息,请告诉我。感谢您的帮助

source("Assign Module.R")
tabPanel("Assign Module",
          sidebarLayout(
            sidebarPanel( "Property Locations",
                          helpText("Enter one address per line below"),
                          tags$style(type="text/css", 
                                     "textarea {width:100%}"),
                          tags$textarea('location', 
                                        placeholder = 'Paste here', 
                                        rows = 8, 
                                        ""),
                          br(),
                          actionButton("goButton", 
                                       "Go!")
            ),

            mainPanel(
              tableOutput('modules')
                      )

 ))
library(ggmap)
library(shiny)
  modules <- eventReactive(input$goButton, {
    geocode<-geocode(as.character(input$location))
    m<-getmodules(geocode)
    df<-cbind(input$location,m)
    return(df)
  })

  output$modules <- renderTable({
    modules()
  })
centers <- aggregate(cbind(data.t$Latitude,data.t$Longitude)~data.t$Cluster, FUN=mean)
n.cluster=nrow(centers)
R <- 3958.756 # Earth mean radius [miles]

radians = function(theta=0){return(theta * pi / 180)}   #convert to radians

dist <- function(xind, yind)    # Define the Grear Circle Distance function
  acos(sin(G[xind, 1]) * sin(C[yind, 1]) + 
         cos(G[xind, 1]) * cos(C[yind, 1]) * cos(C[yind, 2] - G[xind, 2])) * R

modules<-function(df){
  n.row=nrow(df)
  G <- radians(df[,c(2,1)])
  C <- radians(centers[,c(2,3)])    
  dist_mat<- outer(seq.int(n.row), seq.int(n.cluster), dist)
  modules <- apply(dist_mat,MARGIN=1,which.min)

  return(modules)
}
10 E. Delaware Place,   Chicago,    IL  60611
100 Arbor Court,    Wheeling,   IL  60090
100 Center Street,  Mishawaka,  IN  46544
100 Forest Avenue,  Oak Park,   IL  60301
1000 W. Washington Boulevard,   Chicago,    IL  60607
1000 Waukegan Rd.,  Deerfield,  IL  60015
1000-1010 N. Lake Shore Drive,  Chicago,    IL  60611