View source: R/outcome-counts-to-rows.R
outcome.counts.to.rows | R Documentation |
Given a data.frame
containing results of a test with two possible outcomes
that is arranged with the number of "successes" per group in one column
and the number of "failures" per group in another column, return a new
data.frame
that has a single outcome column with 1
for every success
and 0
for every failure, mapping each outcome to a single row.
outcome.counts.to.rows(data, success.counts, failure.counts, outcome)
data |
|
success.counts |
Column with number of successes per group. |
failure.counts |
Column with number of failures per group. |
outcome |
Name to use for the outcome column. |
The output is the format glm()
expects when constructing logistic
regressions. The "successes" and "failures" can be any two mutually
exclusive states. Note that, while one would expect these to be logical
(TRUE and FALSE) values, glm()
requires numeric values. You can think
about these numbers as representing the probability of success, which is
1 for success that actually happened and 0 for successes that did not.
A data.frame
with counts represented as repeated rows with a
number 1 representing a success or a 0 representing a failure.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.