Skip to content

Commit

Permalink
fix: as_flextable.data.frame() supports 'data.table'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Dec 10, 2023
1 parent e4a0cb2 commit 7a87ccb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
config:
- {os: windows-latest, r: 'release', pandoc: '2.19'}
- {os: macOS-latest, r: 'release', pandoc : '2.19'}
- {os: ubuntu-20.04, r: 'release', pandoc : '2.19', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'release', pandoc : '2.9.2.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'release', pandoc : '2.19'}
- {os: ubuntu-20.04, r: 'release', pandoc : '2.9.2.1'}
- {os: ubuntu-latest, r: 'devel', pandoc : '2.19'}

env:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: flextable
Type: Package
Title: Functions for Tabular Reporting
Version: 0.9.5.001
Version: 0.9.5.002
Authors@R: c(
person("David", "Gohel", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Issues

- `summarizor()` don't stop anymore if table only contain discrete columns.
- `as_flextable.data.frame()` supports 'data.table'

# flextable 0.9.4

Expand Down
7 changes: 7 additions & 0 deletions R/df_printer.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ as_flextable.data.frame <- function(x,
show_coltype = TRUE,
color_coltype = "#999999",
...) {

if (inherits(x, "data.table")) {
x <- as.data.frame(x)
} else if (inherits(x, "tbl_df")) {
x <- as.data.frame(x)
}

if (nrow(x) == 1) {
singlerow_df_printer(
dat = x,
Expand Down

0 comments on commit 7a87ccb

Please sign in to comment.