View source: R/convertRawReports2Tables.R
convertRawReports2Tables | R Documentation |
Creates a data frame containing all 2 x 2 contingency tables
given a raw spontaneous reporting (SR) data set. An SR data set
is a binary matrix, where each row is a report. The first
columns represent the presence (1
) or absence of a drug
(0
), the other columns represent the presence or absence
of an event.
The tables are organized as follows:
event j | not event j | total | |
drug i | a | c | a + c |
not drug i | b | d | b + d |
total | a + b | c + d | n_reports
|
convertRawReports2Tables(reports, n_drugs, n_events)
reports |
A binary matrix. Each row is a report |
n_drugs |
The number of drugs |
n_events |
The number of events |
The code is a simplified version of the function create2x2Tables
in the SRSim
package.
A data frame where each row represents a 2 x 2 table. The columns represent:
drug_id |
The ID of the drug |
event_id |
The ID of the event |
a |
Number of times the drug and event appeared together in a report |
b |
Number of times the event appeared without the drug in a report |
c |
Number of times the drug appeared without the event in a report |
d |
Number of times the drug and event both did not appear in a report |
convertRawReports2Tables()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.