@@ -26,5 +26,5 @@ Suggests: | |||
rmarkdown, | |||
purrr, | |||
survival | |||
RoxygenNote: 7.1.1 | |||
RoxygenNote: 7.1.2 | |||
VignetteBuilder: knitr |
@@ -88,14 +88,20 @@ alternatively, you can specify numeric column indices or column names to | |||
indicate which columns to escape, e.g. \code{1:5} (the first 5 columns), | |||
\code{c(1, 3, 4)}, or \code{c(-1, -3)} (all columns except the first and | |||
third), or \code{c('Species', 'Sepal.Length')}; since the row names take | |||
the first column to display, you should add the numeric column indices | |||
by one when using \code{rownames}} | |||
\item{style}{the style name (\url{https://datatables.net/manual/styling/}); | |||
currently only \code{'default'}, \code{'bootstrap'}, and | |||
\code{'bootstrap4'} are supported. Note that DT doesn't contain the theme | |||
files so in order to display the style correctly, you have to link | |||
the necessary files in the header.} | |||
the first column to display, you should add the numeric column indices by | |||
one when using \code{rownames}} | |||
\item{style}{either \code{'auto'}, \code{'default'}, \code{'bootstrap'}, or | |||
\code{'bootstrap4'}. If \code{'auto'}, and a **bslib** theme is | |||
currently active, then bootstrap styling is used in a way that "just works" | |||
for the active theme. Otherwise, | |||
\href{https://datatables.net/manual/styling/classes}{DataTables | |||
\code{'default'} styling} is used. If set explicitly to \code{'bootstrap'} | |||
or \code{'bootstrap4'}, one must take care to ensure Bootstrap's HTML | |||
dependencies (as well as Bootswatch themes, if desired) are included on the | |||
page. Note, when set explicitly, it's the user's responsibility to ensure | |||
that only one unique `style` value is used on the same page, if multiple | |||
DT tables exist, as different styling resources may conflict with each other.} | |||
\item{width}{Width/Height in pixels (optional, defaults to automatic | |||
sizing)} | |||
@@ -110,7 +116,9 @@ it's containing element. If the table can't fit fully into it's container | |||
then vertical and/or horizontal scrolling of the table cells will occur.} | |||
\item{autoHideNavigation}{\code{TRUE} to automatically hide navigational UI | |||
when the number of total records is less than the page size.} | |||
(only display the table body) when the number of total records is less | |||
than the page size. Note, it only works on the client-side processing mode | |||
and the `pageLength` option should be provided explicitly.} | |||
\item{selection}{the row/column selection mode (single or multiple selection | |||
or disable selection) when a table widget is rendered in a Shiny app; | |||
@@ -181,5 +189,5 @@ datatable(data.frame(x = Sys.time())) | |||
### | |||
} | |||
\references{ | |||
See \url{https://rstudio.github.io/DT} for the full documentation. | |||
See \url{https://rstudio.github.io/DT/} for the full documentation. | |||
} |
@@ -42,20 +42,20 @@ labels must be given in the form c(unquoted_variable_name = "label") | |||
The stats can be a function which takes a dataframe and returns a list of statistical functions to use. | |||
stats can also be a named list of statistical functions, or formulas. | |||
stats can also be a named list of statistical functions, or purrr::map like formulas. | |||
The names will be used as column names in the resulting table. If an element of the list is a function, it will be used as-is for the stats. If an element of the list is a formula, it can be used to conditionally use stats depending on the variable. | |||
The general form is \code{condition ~ T | F}, and can be nested, such as \code{is.factor ~ percent | (is.normal ~ mean | median)}, for example. | |||
The names will be used as column names in the resulting table. If an element of the list is a function, it will be used as-is for the stats. | |||
} | |||
\section{Tests}{ | |||
The tests can be a function which takes a variable and a grouping variable, and returns an appropriate statistical test to use in that case. | |||
tests can also be a named list of statistical test functions, associating the name of a variable in the data, and a test to use specifically for that variable. | |||
tests can also be a named list of statistical test functions, associating the name of a variable in the data and a test to use specifically for that variable. | |||
That test name must be expressed as a single-term formula (e.g. \code{~t.test}). You don't have to specify tests for all the variables: a default test for all other variables can be defined with the name \code{.default}, and an automatic test can be defined with the name \code{.auto}. | |||
That test name must be expressed as a single-term formula (e.g. \code{~t.test}), or a purrr::map like formula | |||
(e.g. \code{~t.test(., var.equal = T)}). You don't have to specify tests for all the variables: a default test for | |||
all other variables can be defined with the name \code{.default}, and an automatic test can be defined with the name \code{.auto}. | |||
If data is a grouped dataframe (using \code{group_by}), subtables are created and statistic tests are performed over each sub-group. | |||
} | |||
@@ -72,10 +72,10 @@ iris \%>\% | |||
# Does the same as stats_auto here | |||
iris \%>\% | |||
desctable(stats = list("N" = length, | |||
"\%/Mean" = is.factor ~ percent | (is.normal ~ mean), | |||
"sd" = is.normal ~ sd, | |||
"Med" = is.normal ~ NA | median, | |||
"IQR" = is.normal ~ NA | IQR)) | |||
"Mean" = ~ if (is.normal(.)) mean(.), | |||
"sd" = ~ if (is.normal(.)) sd(.), | |||
"Med" = stats::median, | |||
"IQR" = ~ if(!is.factor(.)) IQR(.))) | |||
# With labels | |||
mtcars \%>\% desctable(labels = c(hp = "Horse Power", | |||
@@ -2,16 +2,16 @@ | |||
% Please edit documentation in R/utils.R | |||
\name{headerList} | |||
\alias{headerList} | |||
\title{Build a header list object} | |||
\title{build a header list object} | |||
\usage{ | |||
headerList(desctable) | |||
} | |||
\arguments{ | |||
\item{desctable}{A desctable} | |||
\item{desctable}{a desctable} | |||
} | |||
\value{ | |||
A nested list of headers with colspans | |||
a nested list of headers with colspans | |||
} | |||
\description{ | |||
Build a header list object | |||
build a header list object | |||
} |
@@ -1,28 +0,0 @@ | |||
% Generated by roxygen2: do not edit by hand | |||
% Please edit documentation in R/utils.R | |||
\name{parse_formula} | |||
\alias{parse_formula} | |||
\title{Parse a formula} | |||
\usage{ | |||
parse_formula(x, f) | |||
} | |||
\arguments{ | |||
\item{x}{The variable to test it on} | |||
\item{f}{A formula to parse} | |||
} | |||
\value{ | |||
A function to use as a stat/test | |||
} | |||
\description{ | |||
Parse a formula defining the conditions to pick a stat/test | |||
} | |||
\details{ | |||
Parse a formula defining the conditions to pick a stat/test | |||
and return the function to use. | |||
The formula is to be given in the form of | |||
conditional ~ T | F | |||
and conditions can be nested such as | |||
conditional1 ~ (conditional2 ~ T | F) | F | |||
The FALSE option can be omitted, and the TRUE can be replaced with NA | |||
} |
@@ -15,7 +15,7 @@ statTable(data, stats) | |||
A dataframe of all statistics for all variables | |||
} | |||
\description{ | |||
If stats is a list of functions, use them. | |||
If stats is a list of functions or purrr::map like formulas, use them. | |||
If it is a single function, use it with the entire data as | |||
its argument to produce a list of statistical functions to use. | |||
} |
@@ -2,15 +2,9 @@ | |||
% Please edit documentation in R/stats.R | |||
\name{statify} | |||
\alias{statify} | |||
\alias{statify.default} | |||
\alias{statify.formula} | |||
\title{Transform any function into a valid stat function for the table} | |||
\usage{ | |||
statify(x, f) | |||
\method{statify}{default}(x, f) | |||
\method{statify}{formula}(x, f) | |||
} | |||
\arguments{ | |||
\item{x}{A vector} | |||