Reputation: 221
In reactable, you can make edits to named columns as follows:
columns = list(
Species = colDef(minWidth = 140),
AnotherNamedColumn = colDef(align = "center")
)
The data I am using changes weekly, and so I can't use a named column. I need to subset from a df this:
columns = list(
df[1,2] = colDef(minWidth = 140),
df[1,3] = colDef(align = "center")
)
But reactable doesn't like this. Does anyone know how I can get this to work and actually get reactable to evaluate the subset code so I can 'point' to the correct column without naming it?
Upvotes: 0
Views: 501
Reputation: 124223
If I got you right then one option to achieve your desired result would look like so:
colDef
s in a listlibrary(reactable)
df <- iris
columns <- list(colDef(minWidth = 140), colDef(align = "center"))
columns <- setNames(columns, names(df)[2:3])
reactable(df, columns = columns)
Upvotes: 1