Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save b-rodrigues/948156d09607e5e8e66b80e5b318a854 to your computer and use it in GitHub Desktop.
Save b-rodrigues/948156d09607e5e8e66b80e5b318a854 to your computer and use it in GitHub Desktop.
options(reactable.theme = reactable::reactableTheme(
color = "hsl(233, 9%, 87%)",
backgroundColor = "#002b36",
borderColor = "#eee8d5",
stripedColor = "#586e75",
highlightColor = "#6c71c4",
inputStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
selectStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonHoverStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonActiveStyle = list(backgroundColor = "hsl(233, 9%, 28%)")
))
view <- function(.data){
if(interactive()) {
reactable::reactable(.data,
filterable = TRUE,
searchable = TRUE,
showPageSizeOptions = TRUE,
striped = TRUE,
highlight = TRUE,
compact = TRUE,
defaultPageSize = 30)
}
}
view_xl <- function(.data){
if(interactive()){
tmp <- tempfile(fileext = ".csv")
data.table::fwrite(.data, tmp)
browseURL(tmp, browser = "gnumeric")
}
}
@ashishdamania
Copy link

Thanks for this gist. Super useful.
In case you are using Excel on MacOS. Use this line for browseURL:

browseURL(tmp, browser = 'open -a "Microsoft Excel"')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment