Creates a DT::datatable object for each dataframe and runs it in a background shiny application in the Rstudio viewer pane.

v(.df_list, .subject_col = NULL)

Arguments

.df_list

A dataframe or list of dataframes that you want to process and view. Named lists will inherit their names when shown in the app.

.subject_col

A character string specifying the subject column. If this column is present in the dataframe, it will be used to group rows in the datatable.

Value

The callr process (invisibly).

Details

For each dataframe in .df_list:

If .subject_col is NULL, the column names "USUBJID" and "ID" will be searched and set if present. If .subject_col is present in the dataframe, it will be frozen and alternate in color.

Columns with less than 20 unique values are converted to factors. This can be helpful for filtering, which will show up as the shiny equivalent of selectInput, as opposed to the default textInput for character columns.

Columns with label attributes will be appended to column headers as a new line.

You can drag and drop columns to move them around in the table. If a column is dragged to a frozen column's location, the new column will be frozen instead.

Note

Notes about the background process:

By running the app as a background process, users will retain access to their console. The process will end when one of the following things happen:

  • the Rstudio viewer pane process is stopped

  • another v() call is executed (only one will run at a time)

  • you manually kill it via the steps below:

    result <- v(mtcars)
    result$kill()
    
    result
    PROCESS 'R', finished.

Examples

if (FALSE) {

 df_list <- mrgda::read_src_dir(system.file("example-sdtm", package = "mrgda"))

 # "USUBJID" automatically detected as `.subject_col`

 v(df_list)

 # manually specify `.subject_col`

 v(df_list, .subject_col = "USUBJID")

}