Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left align of columns works, right align does not #381

Closed
ixodid198 opened this issue Oct 12, 2019 · 1 comment · Fixed by #355
Closed

Left align of columns works, right align does not #381

ixodid198 opened this issue Oct 12, 2019 · 1 comment · Fixed by #355

Comments

@ixodid198
Copy link

ixodid198 commented Oct 12, 2019

Using cols_align I can left align the columns. When I try to right align, the right side of the column names are not aligned with the right of the data. See image below.

library(gt)

can_world_table <- tibble(
  region = c("Canada", "World"),
  target_year = c(20123456, 3479525000),
  current_year = c(38987654, 7713852000)
)

gt(can_world_table) %>% 
  tab_header(
    title = "Population",
    subtitle = "(in millions)"
  ) %>% 
  cols_label(
    region = "",
    target_year = "1967", 
    current_year = "2019"
  ) %>% 
  fmt_number(
    columns = vars(target_year, current_year),
    decimals = 0, 
    scale_by = 1e-6
  ) %>% 
  cols_align(
    align = "right",
    columns = vars(target_year, current_year)
  )

Screen Shot 2019-10-11 at 9 52 44 PM

@rich-iannone
Copy link
Member

Thanks for posting this issue. This one seems to be fixed in a PR that we hope to merge soon (#355). I'll make sure this issue auto closes when that PR is merged to master.

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

Successfully merging a pull request may close this issue.

2 participants