Skip to content

Commit

Permalink
bugfix + tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Jan 25, 2024
1 parent 4b1eaaf commit e368687
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
36 changes: 20 additions & 16 deletions R/style_tabularray.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,26 @@ style_tabularray <- function(x,
iline <- unique(iline)
jline <- unique(jline)
line_width <- paste0(line_width, "em")
tmp <- sprintf(
"hline{%s}={%s}{solid, %s, %s},",
paste(iline, collapse = ","),
paste(jval, collapse = ","),
line_width,
line_color
)
out <- tabularray_insert(out, content = tmp, type = "inner")
tmp <- sprintf(
"vline{%s}={%s}{solid, %s, %s},",
paste(jline, collapse = ","),
paste(ival + meta(x, "nhead"), collapse = ","),
line_width,
line_color
)
out <- tabularray_insert(out, content = tmp, type = "inner")
if (!is.null(iline)) {
tmp <- sprintf(
"hline{%s}={%s}{solid, %s, %s},",
paste(iline, collapse = ","),
paste(jval, collapse = ","),
line_width,
line_color
)
out <- tabularray_insert(out, content = tmp, type = "inner")
}
if (!is.null(jline)) {
tmp <- sprintf(
"vline{%s}={%s}{solid, %s, %s},",
paste(jline, collapse = ","),
paste(ival + meta(x, "nhead"), collapse = ","),
line_width,
line_color
)
out <- tabularray_insert(out, content = tmp, type = "inner")
}
}

out <- tabularray_insert(out, content = tabularray_inner, type = "inner")
Expand Down
6 changes: 3 additions & 3 deletions man/plot_tt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/style_tt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vignettes/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ tt(x) |> save_tt("path/to/file.md")

`save_tt()` can also return a string with the table in it, for further processing in `R`. In the first case, the table is printed to console with `cat()`. In the second case, it returns as a single string as an `R` object.

```{r}
```{r, eval = FALSE}
tt(mtcars[1:10, 1:5]) |>
group_tt(
i = list(
Expand Down Expand Up @@ -590,12 +590,12 @@ The `style_tt` function allows us to customize the borders that surround eacell

Here is an example where we draw lines around every border ("t", "b", "l", and "r") of specified cells.

```{r}
```{r, eval = FALSE}
tt(x, theme = "void") |>
style_tt(
i = 0,
j = 1:4,
line = "tb",
i = 0:3,
j = 1:3,
line = "tblr",
line_width = 0.4,
line_color = "orange")
```
Expand Down

0 comments on commit e368687

Please sign in to comment.