-2

I have a df called crash_speed detailing the number of crashes, casualties and deaths for each speed interval (from 10-110). It looks like the follwing:

df

I'm just wondering how I'd go about in plotting a table of this, and what packages and fucntions to use ect. I pretty much want to just keep the same, but just plot it

3 Answers3

1

I think knitr, kable , and kableExtra are the things you are looking for.
For more info check the docs:
https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_html.html

Before posting a question please do your own research on finding a topic as said in general terms of posting. This answer took 1 minute of googling :)

rkabuk
  • 267
  • 3
  • 15
0

One way is to use gridExtra

library(gridExtra)
df <- iris[1:10,]
grid.table(df)

This outputs to the plot window the following: enter image description here

cgvoller
  • 873
  • 1
  • 14
0

You can either try out the table functions of ggpubr or dive into numerous packages. The easiest way to get started is the gt package which also provides a list of alternatives like

I do also know at least one blog writing about gt tables and the author of the blog additionally maintains a gt extension package.

Seb
  • 332
  • 1
  • 3