nutterb / pixiedust

Tables So Beautifully Fine-Tuned You Will Believe It's Magic.
180 stars 18 forks source link

`justify = "left"` does bad things to the document. #86

Closed nutterb closed 7 years ago

nutterb commented 7 years ago

In HTML, justify = "left" causes subsequent elements to be printed to the right of the table. Compare the following:

---
title: "Untitled"
output: html_document
---
```{r SD and Mean Table, results = 'asis', warning = FALSE}  
library(pixiedust)
mtcars %>%   
  dust(justify = "") %>%  
  medley_all_borders(part = "table") %>%  
  sprinkle_table(halign = "left", pad = 2.5) %>%  
  sprinkle(rows = which(mtcars$gear == 4), 
           col = "mpg", 
           bg = "rgba(255, 00, 00, .7)") %>%  
  sprinkle(rows = which(mtcars$gear == 3), 
           col = "mpg", 
           bg = "rgba(63, 255, 00, .7)") %>%   
  print(asis = FALSE, linebreak_at_end = 0) %>%
  cat()
```

***
### Plots

```{r, results = 'asis', warning = FALSE}  
library(pixiedust)
mtcars %>%   
  dust(justify = "center") %>%  
  medley_all_borders(part = "table") %>%  
  sprinkle_table(halign = "left", pad = 2.5) %>%  
  sprinkle(rows = which(mtcars$gear == 4), 
           col = "mpg", 
           bg = "rgba(255, 00, 00, .7)") %>%  
  sprinkle(rows = which(mtcars$gear == 3), 
           col = "mpg", 
           bg = "rgba(63, 255, 00, .7)") %>%   
  print(asis = FALSE, linebreak_at_end = 0) %>%
  cat()
```

***
### Plots

```{r, results = 'asis', warning = FALSE}  
library(pixiedust)
mtcars %>%   
  dust(justify = "left") %>%  
  medley_all_borders(part = "table") %>%  
  sprinkle_table(halign = "left", pad = 2.5) %>%  
  sprinkle(rows = which(mtcars$gear == 4), 
           col = "mpg", 
           bg = "rgba(255, 00, 00, .7)") %>%  
  sprinkle(rows = which(mtcars$gear == 3), 
           col = "mpg", 
           bg = "rgba(63, 255, 00, .7)") %>%   
  print(asis = FALSE, linebreak_at_end = 0) %>%
  cat()
```

***
### Plots

```{r, results = 'asis', warning = FALSE}  
library(pixiedust)
mtcars %>%   
  dust(justify = "right") %>%  
  medley_all_borders(part = "table") %>%  
  sprinkle_table(halign = "left", pad = 2.5) %>%  
  sprinkle(rows = which(mtcars$gear == 4), 
           col = "mpg", 
           bg = "rgba(255, 00, 00, .7)") %>%  
  sprinkle(rows = which(mtcars$gear == 3), 
           col = "mpg", 
           bg = "rgba(63, 255, 00, .7)") %>%   
  print(asis = FALSE, linebreak_at_end = 0) %>%
  cat()
```

***
### Plots