Description Usage Arguments Value Examples
This function runs a select_events() query and then groups by patient id and picks only the earliest event for each patient
1 2  | first_events(db = NULL, tab, columns = "eventdate", where = NULL,
  sql_only = FALSE, group_column = "patid", date_column = "eventdate")
 | 
db | 
 A database connection object  | 
tab | 
 the database table to extract from  | 
columns | 
 The other columns to be extracted  | 
where | 
 sting representation of the selection criteria  | 
sql_only | 
 logical should the function just return a string of the SQL query?  | 
group_column | 
 column to group by. Default is patid  | 
date_column | 
 the column to sort by. default is eventdate  | 
a dataframe or a string representing an sql query
1 2 3 4 5 6 7  | ## Not run: 
b1 <- first_events(db, tab = "Clinical", columns = c("eventdate", "medcode"), 
where = "medcode %in% .(a$medcode)")
first_events(tab = "Clinical", columns = c("eventdate", "medcode"), 
where = "medcode %in% c(1, 2, 3, 4)", sql_only = TRUE)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.