![]() ![]() Loading the package this took eight keystrokes and no Isn’t this what you basically already want? After Isn’t entwined with a bunch of regression-table functionality. Group, and being a summary-statistics-only function so the documentation Tibbles, factor variables, producing summary statistics by With some additional important bonuses, like working with Statistics functionality of stargazer::stargazer(), except Makes sumtable() very similar in spirit to the summary Produces (and I think a lot of you do!) then it’s perfect and easy. However, if you want the kind of table sumtable() Over your table, those packages are already great, we don’t need another Nor should they be! If you want full control Sumtable() has customization options, but they’reĬertainly not as extensive as with a package like gtsummary St() shortcut, and the intent of not having to set a bunch In the sense of trying to keep the number of keystrokes low (thus the Sumtable and have it pretty much be what you want immediately, and also That’s both in the sense that you should just be able to ask for a Second, sumtable() is designed to have niceĭefaults and be fast to work with. Information about your data while continuing to work on it. RStudio) or the browser (elsewhere), making it easy to look at Sumtable() by default prints its results to Viewer (in There are a huge number of R packages that will make a summary Summary statistics an be for the whole data Sumtable() takes a dataset and outputs a formatted The vtable package serves the purpose of outputtingĪutomatic variable documentation that can be easily viewed whileĭftoHTML()/ dftoLaTeX(). install.Sumtable: Summary Statistics sumtable: Summary Statistics Nick Huntington-Klein Notice that you can specify how many colors we want with the n = 3 argument. The syntax is generally packagename::palette and you will usually have to install the package before accessing the palette. You can run this line of code to look at all the color options: info_paletteer(color_pkgs = NULL) Before adding color to your table, you will need to complete a few additional steps.įirst, install a few new packages and choose a color palette from the many available: install.packages("paletteer") Mean body mass of penguins on different islandsįinally, you can both group and color your columns to help the viewer differentiate between the species. To learn more about these and other customizations, see the kableExtra vignette. Kable_material_dark(html_font = "Cambria") ![]() You can also adjust the font size: kable(x = penguin_sum, Kable_classic(full_width = FALSE, html_font = "Cambria", font_size=16) Additional options with kableExtra include changing the font: kable(x = penguin_sum, To change the width of the table, add full_width = FALSE within your kable_styling() (or similar) argument. Some other options to consider as alternatives to kable_styling() are: kable_classic(), kable_paper(), kable_classic_2(), kable_minimal(), kable_material() and kable_material_dark(). Add the function kable_styling() to get the basic kableExtra format: kable(x = penguin_sum,Ĭaption = "Mean body mass of penguins on different islands over time") %>% Start with very similar code to what you used with the basic kable table. Mean body mass of penguins on different islands over timeįor additional customization options, use the package kableExtra. To make a possibly more appealing table with the same data, use kable(): kable(x = penguin_sum,Ĭol.names = c("Island", "Year", "Mean Body Mass (g)"),Ĭaption = "Mean body mass of penguins on different islands over time") You can print the dataset within R/RStudio: penguin_sum # A tibble: 9 × 3 Summarize(mean_body_mass_g = mean(body_mass_g, na.rm = TRUE)) %>% The below code calculates summary statistics, saved in a new dataset called penguin_sum. (For more information on calculating summary statistics, see the Data Wrangling) section.) Using the palmerpenguins data, calculate the mean value of penguin body mass (g) across islands over time. Summary tables can be useful for displaying data, and the kable() function in the R package knitr allows you to present tables with helpful formatting.įirst, install and load the package. The Summarizing data page shows how to compute summaries of your data. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |