EVOLUTION-MANAGER
Edit File: adorn_title.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Add column name to the top of a two-way tabyl.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for adorn_title {janitor}"><tr><td>adorn_title {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Add column name to the top of a two-way tabyl.</h2> <h3>Description</h3> <p>This function adds the column variable name to the top of a <code>tabyl</code> for a complete display of information. This makes the tabyl prettier, but renders the data.frame less useful for further manipulation. </p> <h3>Usage</h3> <pre> adorn_title(dat, placement = "top", row_name, col_name) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>dat</code></td> <td> <p>a data.frame of class <code>tabyl</code> or other data.frame with a tabyl-like layout. If given a list of data.frames, this function will apply itself to each data.frame in the list (designed for 3-way <code>tabyl</code> lists).</p> </td></tr> <tr valign="top"><td><code>placement</code></td> <td> <p>whether the column name should be added to the top of the tabyl in an otherwise-empty row <code>"top"</code> or appended to the already-present row name variable (<code>"combined"</code>). The formatting in the <code>"top"</code> option has the look of base R's <code>table()</code>; it also wipes out the other column names, making it hard to further use the data.frame besides formatting it for reporting. The <code>"combined"</code> option is more conservative in this regard.</p> </td></tr> <tr valign="top"><td><code>row_name</code></td> <td> <p>(optional) default behavior is to pull the row name from the attributes of the input <code>tabyl</code> object. If you wish to override that text, or if your input is not a <code>tabyl</code>, supply a string here.</p> </td></tr> <tr valign="top"><td><code>col_name</code></td> <td> <p>(optional) default behavior is to pull the column_name from the attributes of the input <code>tabyl</code> object. If you wish to override that text, or if your input is not a <code>tabyl</code>, supply a string here.</p> </td></tr> </table> <h3>Value</h3> <p>the input tabyl, augmented with the column title. Non-tabyl inputs that are of class <code>tbl_df</code> are downgraded to basic data.frames so that the title row prints correctly. </p> <h3>Examples</h3> <pre> mtcars %>% tabyl(am, cyl) %>% adorn_title(placement = "top") # Adding a title to a non-tabyl library(tidyr); library(dplyr) mtcars %>% group_by(gear, am) %>% summarise(avg_mpg = mean(mpg), .groups = "drop") %>% spread(gear, avg_mpg) %>% adorn_rounding() %>% adorn_title("top", row_name = "Gears", col_name = "Cylinders") </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>