R: Visualizing table data, gt

Last Updated on November 4, 2021 by shibatau

I. What do you learn?

Let me show you how to visualize table data beautifully with gt. The gt package is designed for making clean and beautiful display tables, I have created a sample table using RStudio.

The scripts are here:

df1 = read_csv("https://pastebin.com/raw/cSZ8pYWh")
head(df1) |>
  gt() |> 
  tab_header(title = "サンプル・データのはじめの5行です") |> 
  cols_label(id = "番号",
             english = "英語",
             japanese = "日本語",
             nationality = "出身国",
             department = "学部",
             classes = "クラス",
             gender = "性別") |> 
  tab_source_note(source_note = "Source: http://www.mishou.be/2021/10/04/pythonr-sample-data-for-data-analysis/") %>%
    style = list(cell_fill(color = "#F4F4F4")),
    locations = cells_body(columns = c("english", "japanese"))

Refer to https://github.com/rstudio/gt

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.