R interface to the Handsontable JavaScript library v6.2.2 (MIT license).
create interactive spreadsheet-like data grids with data validation, sorting, and filtering.
# install from CRAN
install.packages("handsontable")# or install from GitHub
devtools::install_github("kennedymwavu/handsontable")# load the package:
library(handsontable)
# basic table:
handsontable(mtcars, rowHeaderWidth = 200)# col & row specific config + validation + context menu:
handsontable(
iris[1:8, ],
adaptiveHeight = TRUE
) |>
hot_col(
col = "Species",
type = "dropdown",
source = c("setosa", "versicolor", "virginica")
) |>
hot_validate(
col = 1:4,
type = "numeric",
min = 0
) |>
hot_row(row = 6:7, readOnly = TRUE) |>
hot_context_menu()- right-click to see the context menu
- try entering an invalid value (like a letter) in the first 4 columns.
library(shiny)
ui <- fluidPage(handsontableOutput("table"))
server <- function(input, output) {
output$table <- renderHandsontable({
handsontable(iris[1:10, ]) |>
hot_context_menu()
})
# detect changes:
observeEvent(input$table, {
updated_data <- hot_to_r(data = input$table)
cat("Updated data:\n")
print(updated_data)
# use updated data...
})
}
shinyApp(ui, server)the rhandsontable package provides an R interface to handsontable and has been a valuable tool for the R community. however, it hasn't been actively maintained in recent years.
{handsontable} was developed to ensure active maintenance
with regular updates, bug fixes, and feature enhancements that the community needs.