Top CRAN Packages of 2019
- - + +@@ -209,79 +210,79 @@
tags$link(href = "https://fonts.googleapis.com/css?family=Nunito:400,600,700&display=fallback", rel = "stylesheet")
-.cran-packages {
- font-family: Nunito, "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
-.title {
- font-size: 1.5rem;
-}
-
-.packages-table {
- margin-top: 1rem;
- font-size: 0.9375rem;
- border: 1px solid hsl(213, 33%, 93%);
- border-radius: 4px;
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
-}
-
-.header {
- background-color: hsl(213, 45%, 97%);
- border-bottom-color: hsl(213, 33%, 93%);
- border-bottom-width: 1px;
- color: hsl(213, 13%, 33%);
-}
-
-.header[aria-sort]:hover,
-.header[aria-sort]:focus {
- color: hsl(213, 55%, 50%);
-}
-
-.units {
- margin-left: 0.15em;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.package-title {
- font-size: 0.875rem;
-}
-
-.package-detail {
- padding: 24px;
- box-shadow: inset 0 1px 3px #dbdbdb;
- background: hsl(213, 20%, 99%);
-}
-
-.detail-label {
- margin: 1.25rem 0 0.25rem;
- font-size: 0.875rem;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.detail-header {
- margin-bottom: 1rem;
- font-size: 1.25rem;
- font-weight: 600;
-}
-
-.detail-title {
- margin-left: 1rem;
- font-size: 0.875rem;
- font-weight: 400;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.detail-description {
- font-size: 0.875rem;
-}
-
-.archived-table {
- max-width: 15rem;
- border: 1px solid hsl(213, 33%, 93%);
- border-radius: 4px;
- box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.05);
- font-size: 0.875rem;
-}
+.cran-packages {
+ font-family: Nunito, "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
+
+.title {
+ font-size: 1.5rem;
+}
+
+.packages-table {
+ margin-top: 1rem;
+ font-size: 0.9375rem;
+ border: 1px solid hsl(213, 33%, 93%);
+ border-radius: 4px;
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
+}
+
+.header {
+ background-color: hsl(213, 45%, 97%);
+ border-bottom-color: hsl(213, 33%, 93%);
+ border-bottom-width: 1px;
+ color: hsl(213, 13%, 33%);
+}
+
+.header[aria-sort]:hover,
+.header[aria-sort]:focus {
+ color: hsl(213, 55%, 50%);
+}
+
+.units {
+ margin-left: 0.15em;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.package-title {
+ font-size: 0.875rem;
+}
+
+.package-detail {
+ padding: 24px;
+ box-shadow: inset 0 1px 3px #dbdbdb;
+ background: hsl(213, 20%, 99%);
+}
+
+.detail-label {
+ margin: 1.25rem 0 0.25rem;
+ font-size: 0.875rem;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.detail-header {
+ margin-bottom: 1rem;
+ font-size: 1.25rem;
+ font-weight: 600;
+}
+
+.detail-title {
+ margin-left: 1rem;
+ font-size: 0.875rem;
+ font-weight: 400;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.detail-description {
+ font-size: 0.875rem;
+}
+
+.archived-table {
+ max-width: 15rem;
+ border: 1px solid hsl(213, 33%, 93%);
+ border-radius: 4px;
+ box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.05);
+ font-size: 0.875rem;
+}
tags$link(href = "https://fonts.googleapis.com/css?family=Nunito:400,600,700&display=fallback", rel = "stylesheet")
.cran-packages {
- font-family: Nunito, "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
-.title {
- font-size: 1.5rem;
-}
-
-.packages-table {
- margin-top: 1rem;
- font-size: 0.9375rem;
- border: 1px solid hsl(213, 33%, 93%);
- border-radius: 4px;
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
-}
-
-.header {
- background-color: hsl(213, 45%, 97%);
- border-bottom-color: hsl(213, 33%, 93%);
- border-bottom-width: 1px;
- color: hsl(213, 13%, 33%);
-}
-
-.header[aria-sort]:hover,
-.header[aria-sort]:focus {
- color: hsl(213, 55%, 50%);
-}
-
-.units {
- margin-left: 0.15em;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.package-title {
- font-size: 0.875rem;
-}
-
-.package-detail {
- padding: 24px;
- box-shadow: inset 0 1px 3px #dbdbdb;
- background: hsl(213, 20%, 99%);
-}
-
-.detail-label {
- margin: 1.25rem 0 0.25rem;
- font-size: 0.875rem;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.detail-header {
- margin-bottom: 1rem;
- font-size: 1.25rem;
- font-weight: 600;
-}
-
-.detail-title {
- margin-left: 1rem;
- font-size: 0.875rem;
- font-weight: 400;
- color: rgba(0, 0, 0, 0.6);
-}
-
-.detail-description {
- font-size: 0.875rem;
-}
-
-.archived-table {
- max-width: 15rem;
- border: 1px solid hsl(213, 33%, 93%);
- border-radius: 4px;
- box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.05);
- font-size: 0.875rem;
-}
.cran-packages {
+ font-family: Nunito, "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
+
+.title {
+ font-size: 1.5rem;
+}
+
+.packages-table {
+ margin-top: 1rem;
+ font-size: 0.9375rem;
+ border: 1px solid hsl(213, 33%, 93%);
+ border-radius: 4px;
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
+}
+
+.header {
+ background-color: hsl(213, 45%, 97%);
+ border-bottom-color: hsl(213, 33%, 93%);
+ border-bottom-width: 1px;
+ color: hsl(213, 13%, 33%);
+}
+
+.header[aria-sort]:hover,
+.header[aria-sort]:focus {
+ color: hsl(213, 55%, 50%);
+}
+
+.units {
+ margin-left: 0.15em;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.package-title {
+ font-size: 0.875rem;
+}
+
+.package-detail {
+ padding: 24px;
+ box-shadow: inset 0 1px 3px #dbdbdb;
+ background: hsl(213, 20%, 99%);
+}
+
+.detail-label {
+ margin: 1.25rem 0 0.25rem;
+ font-size: 0.875rem;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.detail-header {
+ margin-bottom: 1rem;
+ font-size: 1.25rem;
+ font-weight: 600;
+}
+
+.detail-title {
+ margin-left: 1rem;
+ font-size: 0.875rem;
+ font-weight: 400;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.detail-description {
+ font-size: 0.875rem;
+}
+
+.archived-table {
+ max-width: 15rem;
+ border: 1px solid hsl(213, 33%, 93%);
+ border-radius: 4px;
+ box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.05);
+ font-size: 0.875rem;
+}
To find other Unicode arrows and symbols, see https://en.wikipedia.org/wiki/Arrow_(symbol)#Arrows_in_Unicode or https://www.fileformat.info/info/unicode/block/geometric_shapes/list.htm.
- - - - + +JavaScript style function
@@ -1333,8 +1334,8 @@ JavaScript style function }
}")
)
Highlight rows on hover
reactable(iris[1:5, ], highlight = TRUE)
-
-
+
+
reactable(iris[1:5, ], highlight = TRUE)
Bordered
reactable(iris[1:5, ], bordered = TRUE)
Borderless
reactable(iris[1:5, ], borderless = TRUE)
Outlined
reactable(iris[1:5, ], outlined = TRUE)
Striped
reactable(iris[1:5, ], striped = TRUE)
Bordered + striped + highlighting
reactable(iris[1:5, ], bordered = TRUE, striped = TRUE, highlight = TRUE)
Outlined + borderless
reactable(iris[1:5, ], outlined = TRUE, borderless = TRUE)
Compact
reactable(iris[1:5, ], compact = TRUE)
No text wrapping
@@ -1498,8 +1499,8 @@ No text wrapping bordered = TRUE,
columns = list(Petal.Length = colDef(name = "Petal Length (cm)", minWidth = 50))
)
Fixed height + sticky header/footer
@@ -1521,8 +1522,8 @@ Fixed height + sticky header/footer }
)
)
Column widths
@@ -1558,8 +1559,8 @@ Column widths),
bordered = TRUE
)
No full width
@@ -1575,8 +1576,8 @@ No full width= colDef(minWidth = 120)
)
You can also set a maximum or fixed width on the table:
@@ -1590,8 +1591,8 @@No full width= 650 )
Vertical alignment= colDef(vAlign = "center", headerVAlign = "bottom"), bordered = TRUE )
Custom CSS
@@ -1653,8 +1654,8 @@ Custom CSS),
rowClass = "my-row"
)
Basic Usage{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4,4.6,5,4.4,4.9,5.4,4.8,4.8,4.3,5.8,5.7,5.4,5.1,5.7,5.1,5.4,5.1,4.6,5.1,4.8,5,5,5.2,5.2,4.7,4.8,5.4,5.2,5.5,4.9,5,5.5,4.9,4.4,5.1,5,4.5,4.4,5,5.1,4.8,5.1,4.6,5.3,5,7,6.4,6.9,5.5,6.5,5.7,6.3,4.9,6.6,5.2,5,5.9,6,6.1,5.6,6.7,5.6,5.8,6.2,5.6,5.9,6.1,6.3,6.1,6.4,6.6,6.8,6.7,6,5.7,5.5,5.5,5.8,6,5.4,6,6.7,6.3,5.6,5.5,5.5,6.1,5.8,5,5.6,5.7,5.7,6.2,5.1,5.7,6.3,5.8,7.1,6.3,6.5,7.6,4.9,7.3,6.7,7.2,6.5,6.4,6.8,5.7,5.8,6.4,6.5,7.7,7.7,6,6.9,5.6,7.7,6.3,6.7,7.2,6.2,6.1,6.4,7.2,7.4,7.9,6.4,6.3,6.1,7.7,6.3,6.4,6,6.9,6.7,6.9,5.8,6.8,6.7,6.7,6.3,6.5,6.2,5.9],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9,3.4,3.4,2.9,3.1,3.7,3.4,3,3,4,4.4,3.9,3.5,3.8,3.8,3.4,3.7,3.6,3.3,3.4,3,3.4,3.5,3.4,3.2,3.1,3.4,4.1,4.2,3.1,3.2,3.5,3.6,3,3.4,3.5,2.3,3.2,3.5,3.8,3,3.8,3.2,3.7,3.3,3.2,3.2,3.1,2.3,2.8,2.8,3.3,2.4,2.9,2.7,2,3,2.2,2.9,2.9,3.1,3,2.7,2.2,2.5,3.2,2.8,2.5,2.8,2.9,3,2.8,3,2.9,2.6,2.4,2.4,2.7,2.7,3,3.4,3.1,2.3,3,2.5,2.6,3,2.6,2.3,2.7,3,2.9,2.9,2.5,2.8,3.3,2.7,3,2.9,3,3,2.5,2.9,2.5,3.6,3.2,2.7,3,2.5,2.8,3.2,3,3.8,2.6,2.2,3.2,2.8,2.8,2.7,3.3,3.2,2.8,3,2.8,3,2.8,3.8,2.8,2.8,2.6,3,3.4,3.1,3,3.1,3.1,3.1,2.7,3.2,3.3,3,2.5,3,3.4,3],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7,1.4,1.5,1.4,1.5,1.5,1.6,1.4,1.1,1.2,1.5,1.3,1.4,1.7,1.5,1.7,1.5,1,1.7,1.9,1.6,1.6,1.5,1.4,1.6,1.6,1.5,1.5,1.4,1.5,1.2,1.3,1.4,1.3,1.5,1.3,1.3,1.3,1.6,1.9,1.4,1.6,1.4,1.5,1.4,4.7,4.5,4.9,4,4.6,4.5,4.7,3.3,4.6,3.9,3.5,4.2,4,4.7,3.6,4.4,4.5,4.1,4.5,3.9,4.8,4,4.9,4.7,4.3,4.4,4.8,5,4.5,3.5,3.8,3.7,3.9,5.1,4.5,4.5,4.7,4.4,4.1,4,4.4,4.6,4,3.3,4.2,4.2,4.2,4.3,3,4.1,6,5.1,5.9,5.6,5.8,6.6,4.5,6.3,5.8,6.1,5.1,5.3,5.5,5,5.1,5.3,5.5,6.7,6.9,5,5.7,4.9,6.7,4.9,5.7,6,4.8,4.9,5.6,5.8,6.1,6.4,5.6,5.1,5.6,6.1,5.6,5.5,4.8,5.4,5.6,5.1,5.1,5.9,5.7,5.2,5,5.2,5.4,5.1],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4,0.3,0.2,0.2,0.1,0.2,0.2,0.1,0.1,0.2,0.4,0.4,0.3,0.3,0.3,0.2,0.4,0.2,0.5,0.2,0.2,0.4,0.2,0.2,0.2,0.2,0.4,0.1,0.2,0.2,0.2,0.2,0.1,0.2,0.2,0.3,0.3,0.2,0.6,0.4,0.3,0.2,0.2,0.2,0.2,1.4,1.5,1.5,1.3,1.5,1.3,1.6,1,1.3,1.4,1,1.5,1,1.4,1.3,1.4,1.5,1,1.5,1.1,1.8,1.3,1.5,1.2,1.3,1.4,1.4,1.7,1.5,1,1.1,1,1.2,1.6,1.5,1.6,1.5,1.3,1.3,1.3,1.2,1.4,1.2,1,1.3,1.2,1.3,1.3,1.1,1.3,2.5,1.9,2.1,1.8,2.2,2.1,1.7,1.8,1.8,2.5,2,1.9,2.1,2,2.4,2.3,1.8,2.2,2.3,1.5,2.3,2,2,1.8,2.1,1.8,1.8,1.8,2.1,1.6,1.9,2,2.2,1.5,1.4,2.3,2.4,1.8,1.8,2.1,2.4,2.3,1.9,2.3,2.5,2.3,1.9,2,2.3,1.8],"Species":["setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","versicolor","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"dataKey":"1980abf4c53c6ff35ad17d6d5d0650a0"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Column definitions
Columns can be customized by providing a named list of column
@@ -248,7 +249,7 @@
Column definitions= colDef(align = "center")
)
)
-
+
-For convenience, you can also specify a default colDef()
+
For convenience, you can also specify a default colDef()
to use for all columns in defaultColDef
:
reactable(
@@ -324,7 +325,7 @@ Column definitions= TRUE,
highlight = TRUE
)
-
+
@@ -411,7 +412,7 @@ Default sorted columnsdefaultSorted:
-
+
-You can also provide a named list to customize the default sort
+
You can also provide a named list to customize the default sort
orders. Use "asc"
for ascending order, or
"desc"
for descending order:
-
+
Default sort order
@@ -555,7 +556,7 @@ Default sort order),
defaultSorted = c("Species", "Petal.Length")
)
-
+
Sort missing values last
@@ -630,7 +631,7 @@ Sort missing values last defaultColDef = colDef(sortNALast = TRUE),
defaultSorted = "x"
)
-
+
No sorting
@@ -691,7 +692,7 @@ No sorting= colDef(sortable = TRUE)
)
)
-
Hide sort icons
@@ -752,7 +753,7 @@ Hide sort icons.
reactable(iris[1:5, ], showSortIcon = FALSE)
-
@@ -811,7 +812,7 @@ Filteringdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, filterable = TRUE, minRows = 10)
-
+
@@ -924,7 +925,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"filterable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}To make specific columns filterable (or not), set
+
To make specific columns filterable (or not), set
filterable
to TRUE
or FALSE
in
colDef()
:
@@ -936,7 +937,7 @@ Filtering),
defaultPageSize = 5
)
-
+
@@ -1014,7 +1015,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric","filterable":false}],"filterable":true,"defaultPageSize":5,"dataKey":"29704e01ca83ef47032806b9ddd3271b"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom filtering
Column filtering can be customized using the
@@ -1043,7 +1044,7 @@
Custom filtering ),
defaultPageSize = 5
)
-
+
@@ -1123,7 +1124,7 @@ Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)
-
+
@@ -1227,7 +1228,7 @@ Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
Column definitions
Columns can be customized by providing a named list of column @@ -248,7 +249,7 @@
Column definitions= colDef(align = "center") ) )
For convenience, you can also specify a default colDef()
+
For convenience, you can also specify a default colDef()
to use for all columns in defaultColDef
:
reactable(
@@ -324,7 +325,7 @@ Column definitions= TRUE,
highlight = TRUE
)
Default sorted columnsdefaultSorted:
-
+
-You can also provide a named list to customize the default sort
+
You can also provide a named list to customize the default sort
orders. Use "asc"
for ascending order, or
"desc"
for descending order:
-
+
Default sort order
@@ -555,7 +556,7 @@ Default sort order),
defaultSorted = c("Species", "Petal.Length")
)
-
+
Sort missing values last
@@ -630,7 +631,7 @@ Sort missing values last defaultColDef = colDef(sortNALast = TRUE),
defaultSorted = "x"
)
-
+
No sorting
@@ -691,7 +692,7 @@ No sorting= colDef(sortable = TRUE)
)
)
-
Hide sort icons
@@ -752,7 +753,7 @@ Hide sort icons.
reactable(iris[1:5, ], showSortIcon = FALSE)
-
@@ -811,7 +812,7 @@ Filteringdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, filterable = TRUE, minRows = 10)
-
+
@@ -924,7 +925,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"filterable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}To make specific columns filterable (or not), set
+
To make specific columns filterable (or not), set
filterable
to TRUE
or FALSE
in
colDef()
:
@@ -936,7 +937,7 @@ Filtering),
defaultPageSize = 5
)
-
+
@@ -1014,7 +1015,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric","filterable":false}],"filterable":true,"defaultPageSize":5,"dataKey":"29704e01ca83ef47032806b9ddd3271b"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom filtering
Column filtering can be customized using the
@@ -1043,7 +1044,7 @@
Custom filtering ),
defaultPageSize = 5
)
-
+
@@ -1123,7 +1124,7 @@ Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)
-
+
@@ -1227,7 +1228,7 @@ Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
You can also provide a named list to customize the default sort +
You can also provide a named list to customize the default sort
orders. Use "asc"
for ascending order, or
"desc"
for descending order:
Default sort order
@@ -555,7 +556,7 @@ Default sort order),
defaultSorted = c("Species", "Petal.Length")
)
Sort missing values last
@@ -630,7 +631,7 @@ Sort missing values last defaultColDef = colDef(sortNALast = TRUE),
defaultSorted = "x"
)
No sorting
@@ -691,7 +692,7 @@ No sorting= colDef(sortable = TRUE)
)
)
Hide sort icons
@@ -752,7 +753,7 @@ Hide sort icons.
reactable(iris[1:5, ], showSortIcon = FALSE)
-
@@ -811,7 +812,7 @@ Filteringdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, filterable = TRUE, minRows = 10)
-
+
@@ -924,7 +925,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"filterable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}To make specific columns filterable (or not), set
+
To make specific columns filterable (or not), set
filterable
to TRUE
or FALSE
in
colDef()
:
@@ -936,7 +937,7 @@ Filtering),
defaultPageSize = 5
)
-
+
@@ -1014,7 +1015,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric","filterable":false}],"filterable":true,"defaultPageSize":5,"dataKey":"29704e01ca83ef47032806b9ddd3271b"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom filtering
Column filtering can be customized using the
@@ -1043,7 +1044,7 @@
Custom filtering ),
defaultPageSize = 5
)
-
+
@@ -1123,7 +1124,7 @@ Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)
-
+
@@ -1227,7 +1228,7 @@ Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
reactable(iris[1:5, ], showSortIcon = FALSE)
Filteringdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")] reactable(data, filterable = TRUE, minRows = 10)
Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"filterable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}To make specific columns filterable (or not), set
+
To make specific columns filterable (or not), set
filterable
to TRUE
or FALSE
in
colDef()
:
@@ -936,7 +937,7 @@ Filtering),
defaultPageSize = 5
)
-
+
@@ -1014,7 +1015,7 @@ Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric","filterable":false}],"filterable":true,"defaultPageSize":5,"dataKey":"29704e01ca83ef47032806b9ddd3271b"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom filtering
Column filtering can be customized using the
@@ -1043,7 +1044,7 @@
Custom filtering ),
defaultPageSize = 5
)
-
+
@@ -1123,7 +1124,7 @@ Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)
-
+
@@ -1227,7 +1228,7 @@ Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
filterable
to TRUE
or FALSE
in
colDef()
:@@ -936,7 +937,7 @@Filtering), defaultPageSize = 5 )
Filtering{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric","filterable":false}],"filterable":true,"defaultPageSize":5,"dataKey":"29704e01ca83ef47032806b9ddd3271b"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom filtering
Column filtering can be customized using the
@@ -1043,7 +1044,7 @@
Custom filtering ),
defaultPageSize = 5
)
-
+
@@ -1123,7 +1124,7 @@ Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)
-
+
@@ -1227,7 +1228,7 @@ Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
Custom filtering
Column filtering can be customized using the @@ -1043,7 +1044,7 @@
Custom filtering ), defaultPageSize = 5 )
Searchingdata <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")] reactable(data, searchable = TRUE, minRows = 10)
Searching{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Manufacturer":["Acura","Acura","Audi","Audi","BMW","Buick","Buick","Buick","Buick","Cadillac","Cadillac","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chevrolet","Chrylser"],"Model":["Integra","Legend","90","100","535i","Century","LeSabre","Roadmaster","Riviera","DeVille","Seville","Cavalier","Corsica","Camaro","Lumina","Lumina_APV","Astro","Caprice","Corvette","Concorde"],"Type":["Small","Midsize","Compact","Midsize","Midsize","Midsize","Large","Large","Midsize","Large","Midsize","Compact","Compact","Sporty","Midsize","Van","Van","Large","Sporty","Large"],"AirBags":["None","Driver & Passenger","Driver only","Driver & Passenger","Driver only","Driver only","Driver only","Driver only","Driver only","Driver only","Driver & Passenger","None","Driver only","Driver & Passenger","None","None","None","Driver only","Driver only","Driver & Passenger"],"Price":[15.9,33.9,29.1,37.7,30,15.7,20.8,23.7,26.3,34.7,40.1,13.4,11.4,15.1,15.9,16.3,16.6,18.8,38,18.4]},"columns":[{"id":"Manufacturer","name":"Manufacturer","type":"factor"},{"id":"Model","name":"Model","type":"factor"},{"id":"Type","name":"Type","type":"factor"},{"id":"AirBags","name":"AirBags","type":"factor"},{"id":"Price","name":"Price","type":"numeric"}],"searchable":true,"minRows":10,"dataKey":"55e896d6e49b979ddd4597432695f612"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Custom searching
The table search method can be customized using the
@@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
-
+
@@ -1302,12 +1303,12 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
Custom searching
The table search method can be customized using the @@ -1243,7 +1244,7 @@
Pagination
reactable(iris[1:6, ], defaultPageSize = 4)
reactable(iris[1:6, ], defaultPageSize = 4)
Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"defaultPageSize":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}You can also set the minimum rows per page using
+
You can also set the minimum rows per page using
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
-
+
@@ -1366,7 +1367,7 @@ Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
minRows
. This may be useful when rows don’t completely fill
the page, or if the table has filtering:
reactable(iris[1:6, ], defaultPageSize = 4, minRows = 4, searchable = TRUE)
Pagination{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Sepal.Length":[5.1,4.9,4.7,4.6,5,5.4],"Sepal.Width":[3.5,3,3.2,3.1,3.6,3.9],"Petal.Length":[1.4,1.4,1.3,1.5,1.4,1.7],"Petal.Width":[0.2,0.2,0.2,0.2,0.2,0.4],"Species":["setosa","setosa","setosa","setosa","setosa","setosa"]},"columns":[{"id":"Sepal.Length","name":"Sepal.Length","type":"numeric"},{"id":"Sepal.Width","name":"Sepal.Width","type":"numeric"},{"id":"Petal.Length","name":"Petal.Length","type":"numeric"},{"id":"Petal.Width","name":"Petal.Width","type":"numeric"},{"id":"Species","name":"Species","type":"factor"}],"searchable":true,"defaultPageSize":4,"minRows":4,"dataKey":"6cc0494dfe181a040ad2dea9b85ee3d1"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}
+
Page size options
You can show a dropdown of page sizes for users to choose from using
@@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12),
defaultPageSize = 4
)
-
+
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
-
+
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
-
+
@@ -1600,7 +1601,7 @@ Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
Page size options
You can show a dropdown of page sizes for users to choose from using @@ -1379,7 +1380,7 @@
Page size options= c(4, 8, 12), defaultPageSize = 4 )
Alternative pagination types
@@ -1462,7 +1463,7 @@ Page jump
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
reactable(iris[1:50, ], paginationType = "jump", defaultPageSize = 4)
Simple
reactable(iris[1:50, ], paginationType = "simple", defaultPageSize = 4)
Hide page infoFALSE:
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
-
+
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
-
+
Always show pagination
@@ -1735,7 +1736,7 @@ Always show pagination
reactable(iris[1:5, ], showPagination = TRUE)
-
+
No pagination
@@ -1810,7 +1811,7 @@ No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
-
+
-
+
Tip: Disabling pagination is not recommended for
large tables with many interactive elements (such as links, expand
buttons, or selection checkboxes), as that can make it difficult for
@@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Manufacturer")
-
+
-When rows are grouped, you can aggregate data in a column using an
+
When rows are grouped, you can aggregate data in a column using an
aggregate
function:
data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")]
@@ -2062,7 +2063,7 @@ Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency")
)
)
-
+
-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
colDef(aggregate = "sum") # Sum of numbers
colDef(aggregate = "mean") # Mean of numbers
@@ -2180,7 +2181,7 @@ Multiple groups ),
bordered = TRUE
)
-
+
Custom aggregate function
@@ -2242,21 +2243,21 @@ Custom aggregate functionWithin a custom aggregate function, you can access the values in the
column using the values
argument, and the values in other
columns using the rows
argument:
-columns = list(
- Price = colDef(
- aggregate = JS("function(values, rows) {
- values
- // [46.8, 27.6, 57]
-
- rows
- // [
- // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
- // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
- // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
- // ]
- }")
- )
-)
+columns = list(
+ Price = colDef(
+ aggregate = JS("function(values, rows) {
+ values
+ // [46.8, 27.6, 57]
+
+ rows
+ // [
+ // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 },
+ // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 },
+ // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 }
+ // ]
+ }")
+ )
+)
Here’s an example that calculates an aggregate average price by
dividing the the sum of two columns, Price
and
Units
:
@@ -2291,7 +2292,7 @@ Custom aggregate function )
)
)
-
+
Include sub rows in pagination
@@ -2361,7 +2362,7 @@ Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")]
reactable(data, groupBy = "Type", paginateSubRows = TRUE)
-
+
@@ -2482,7 +2483,7 @@ Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)),
date = colDef(format = colFormat(date = TRUE, locales = "en-GB"))
))
-
+
-
+
Date formatting
@@ -2553,7 +2554,7 @@ Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)),
datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR"))
))
-
+
Currency formatting
@@ -2632,7 +2633,7 @@ Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA")
)
))
-
+
Formatting aggregated cells
@@ -2729,7 +2730,7 @@ Formatting aggregated cells)
)
)
-
+
Displaying missing values
@@ -2791,7 +2792,7 @@ Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE))
)
)
-
+
Custom data formatting
@@ -2884,7 +2885,7 @@ R render functionpaste0("$", format(value * 1000, big.mark = ","))
})
))
-
+
JavaScript render function
@@ -2974,7 +2975,7 @@ JavaScript render function }
"))
))
-
+
Embedding HTML widgets
@@ -3060,7 +3061,7 @@ Embedding HTML widgets sparkline(data$weight[[index]])
})
))
-
+
reactable(iris[1:12, ], showPageInfo = FALSE, defaultPageSize = 4)
+-reactable(iris[1:12, ], showPageInfo = FALSE, showPageSizeOptions = TRUE, defaultPageSize = 4)
+Always show pagination @@ -1735,7 +1736,7 @@
Always show pagination
-reactable(iris[1:5, ], showPagination = TRUE)
+-No pagination @@ -1810,7 +1811,7 @@
No pagination
reactable(iris[1:20, ], pagination = FALSE, highlight = TRUE, height = 250)
+-+-Tip: Disabling pagination is not recommended for large tables with many interactive elements (such as links, expand buttons, or selection checkboxes), as that can make it difficult for @@ -1990,7 +1991,7 @@
Grouping and Aggregationdata <- MASS::Cars93[10:22, c("Manufacturer", "Model", "Type", "Price", "MPG.city")] reactable(data, groupBy = "Manufacturer")
+-When rows are grouped, you can aggregate data in a column using an +
When rows are grouped, you can aggregate data in a column using an
aggregate
function:-data <- MASS::Cars93[14:38, c("Type", "Price", "MPG.city", "DriveTrain", "Man.trans.avail")] @@ -2062,7 +2063,7 @@
Grouping and Aggregation Man.trans.avail = colDef(aggregate = "frequency") ) )
+-You can use one of the built-in aggregate functions:
+You can use one of the built-in aggregate functions:
-colDef(aggregate = "sum") # Sum of numbers colDef(aggregate = "mean") # Mean of numbers @@ -2180,7 +2181,7 @@
Multiple groups ), bordered = TRUE )
+-Custom aggregate function @@ -2242,21 +2243,21 @@
Custom aggregate functionWithin a custom aggregate function, you can access the values in the column using the
values
argument, and the values in other columns using therows
argument: -+columns = list( - Price = colDef( - aggregate = JS("function(values, rows) { - values - // [46.8, 27.6, 57] - - rows - // [ - // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 }, - // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 }, - // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 } - // ] - }") - ) -)
columns = list( + Price = colDef( + aggregate = JS("function(values, rows) { + values + // [46.8, 27.6, 57] + + rows + // [ + // { "Model": "Dynasty", "Manufacturer": "Dodge", "Price": 46.8, "Units": 2 }, + // { "Model": "Colt", "Manufacturer": "Dodge", "Price": 27.6, "Units": 5 }, + // { "Model": "Caravan", "Manufacturer": "Dodge", "Price": 57, "Units": 5 } + // ] + }") + ) +)
Here’s an example that calculates an aggregate average price by dividing the the sum of two columns,
@@ -2291,7 +2292,7 @@Price
andUnits
:Custom aggregate function ) ) )
+-Include sub rows in pagination @@ -2361,7 +2362,7 @@
Include sub rows in paginationdata <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price", "MPG.city")] reactable(data, groupBy = "Type", paginateSubRows = TRUE)
+@@ -2482,7 +2483,7 @@-Column Formatting= colDef(format = colFormat(percent = TRUE, digits = 1)), date = colDef(format = colFormat(date = TRUE, locales = "en-GB")) ))
+-+Date formatting
-@@ -2553,7 +2554,7 @@Date formatting time_24h = colDef(format = colFormat(time = TRUE, hour12 = FALSE)), datetime_pt_BR = colDef(format = colFormat(datetime = TRUE, locales = "pt-BR")) ))
+-Currency formatting @@ -2632,7 +2633,7 @@
Currency formatting= colFormat(currency = "MAD", separators = TRUE, locales = "ar-MA") ) ))
+-Formatting aggregated cells @@ -2729,7 +2730,7 @@
Formatting aggregated cells) ) )
+-Displaying missing values @@ -2791,7 +2792,7 @@
Displaying missing values y = colDef(na = "NA", format = colFormat(percent = TRUE)) ) )
+-Custom data formatting @@ -2884,7 +2885,7 @@
R render functionpaste0("$", format(value * 1000, big.mark = ",")) }) ))
+-JavaScript render function @@ -2974,7 +2975,7 @@
JavaScript render function } ")) ))
+-Embedding HTML widgets @@ -3060,7 +3061,7 @@
Embedding HTML widgets sparkline(data$weight[[index]]) }) ))
+