Upon running this script, I create a DT table with two columns "Customers_one" and "Customers_two", a selectInput and SliderInput in R shiny. I select a name from selecInput
which is in the first column too and compare it with the second column and give percentage similarity between the two in the third column. My issue is that, in the last two # statements in server code, I am trying to make the table such that when slider points at a value say "75", I get rows only with similarity greater or equal to 75%. This, however, does not work when slider points at 100. I want the slider to point at 100 and give me rows with only 100%, Also when 80, rows with 80% and above, so with "85","90". At 100, I see the entire dataset and this is the problem. Please help.
## app.R ##
library(shiny)
library(shinydashboard)
library(stringdist)
library(RecordLinkage)
library(dplyr)
library(scales)
library(DT)
Customers_one =
c("Ashminkaul","Ashminkaul","Ashminkaur","Ashminkau","Ashmkaul","Ainkaul")
Customers_two =
c("Ashminkau","Ashminka","Ashminkaul","Ashmink","Ashminkaul","Ashminkaulb")
Customers_one = as.character(Customers_one)
Customers_two = as.character(Customers_two)
ui <- fluidPage(
titlePanel("DT table Issue"),
# Create a new Row in the UI for selectInputs
fluidRow(
column(4,
selectInput("names",
"Customer:",
c(as.character(Customers_one))),
sliderInput("slide", "Select the name with similarity %",
min = 75, max = 100,
value = 75, step = 5)
)),
# Create a new row for the table.
fluidRow(
DT::dataTableOutput("table")
)
)
server <- function(input, output) {
output$table <- DT::renderDataTable(DT::datatable({
similarity = percent(RecordLinkage::levenshteinSim(input$names,
Customers_two))
combine_total = data.frame(Customers_one,Customers_two, similarity)
combine_total
#combine_total1 = subset(combine_total, similarity >= input$slide)
#combine_total1
}))
}
shinyApp(ui, server)