ruser-interfaceshinyrating

Is there a way to *output* star rating in R Shiny?


Dears,

In my app, users rate some stuff.

I want to output 5-star ratings based on their ratings just like the ones in IMDB.

There are fractions in my numbers, and I want the stars to accommodate them.

I don't know Java nor JavaScript at all.

Is there something like a package for this? or what to do?

Thanks in advance.


Solution

  • I wrote a package to solve similar problem so that others don't need to work with CSS and JS. https://github.com/shahronak47/shinyRatings

    #Installation of the package from Github
    #devtools::install_github('shahronak47/shinyRatings')
    
    library(shiny)
    library(shinyRatings)
    
    ui <- fluidPage(
      shinyRatings('star'), 
      textOutput('text')
    )
    
    server <- function(input, output, session) {
      output$text <- renderText({paste("No. of stars : ", input$star)})
    }
    
    shinyApp(ui, server)
    

    enter image description here