check_study_data_frame: Check various characteristics of the study data frame before...

Description Usage Arguments Value Author(s) References Examples

View source: R/check_study_data_frame.R

Description

Check various characteristics of the study data frame before fitting longitudinal models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
check_study_data_frame(
  input_data_frame,
  study_id_name = NULL,
  studyProtocol_name = NULL,
  return_all_columns = FALSE,
  converted_factor_order = c("observed", "alphanumeric"),
  order_rows = TRUE,
  freeze_factor = TRUE,
  autoconvert_types = TRUE,
  print_warnings = TRUE,
  return_unique = TRUE,
  group_name = maeve_options("group_name"),
  subject_ID = maeve_options("subject_ID"),
  x_name = maeve_options("x_name"),
  endpoint_name = maeve_options("endpoint_name"),
  reference_Dunnett = maeve_options("reference_Dunnett"),
  progress = maeve_options("progress"),
  abbreviate_n = maeve_options("abbreviate_n")
)

Arguments

input_data_frame

a data.frame with raw data from DIVOS.

study_id_name

character string with name of study (usually a 4- or 5-digit number).

studyProtocol_name

character string with name of study protocol (e.g., a LASAR protocol).

return_all_columns

logical: return all the columns in the processed data.frame, or just a minimally required subset?

converted_factor_order

character string: either 'observed' or 'alphanumeric' for whether fields (usually numeric or character) should be leveled in order of values observed or by unique alphanumeric value.

order_rows

logical: Should rows in returned data.frame be ordered by group, then ID, then time?

freeze_factor

logical: Should factors levels be set to the order observed in the returned data.frame?

autoconvert_types

logical. Automatically convert (1) "character" for group_name to "factor", (2) "integer" or "numeric" for subject_ID to factor(character()), (3) "integer" for x_name to "numeric"?

print_warnings

logical. Print warnings if automatic conversions are taking place?

return_unique

logical. Return only the unique rows based on the columns extracted?

group_name

character column name for the group name factor

subject_ID

character column name for the subject name factor

x_name

character column name for the x-axis / time field

endpoint_name

character column name for the x-axis / time field

reference_Dunnett

character string with the group factor level to use as Dunnett reference. If NULL, the first level should be used.

progress

logical. Print out various progress messages from the functions.

abbreviate_n

numeric. Maximum number of characters in a group name.

Value

An R data.frame

Author(s)

Bill Forrest <forrest@gene.com>

Bill Forrest forrest@gene.com

References

www.r-project.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
   cat('exmaples in dontrun{} code block.')
   ## Not run: 
   ### (1) Will generate a (typically harmless) warning that 'x' is class 'integer',
   ###     but converted to 'numeric':
   fake_data_01 = expand.grid( ID = paste0('ID_0',1:6) , x = as.integer( 1:5 ) )
   fake_data_01 = dplyr::arrange( fake_data_01 , ID )
   fake_data_01 = cbind( fake_study_id = 'fake',
                         grp = rep( c('grp_01','grp_02'), each = 15 ), 
                         fake_data_01, 
                         resp = rnorm(30), 
                         dreck = 'drop_this!' )
   checked_data_01 = check_study_data_frame( 
                         fake_data_01, 
                         group_name = 'grp', 
                         subject_ID = 'ID', 
                         x_name = 'x', 
                         endpoint_name = 'resp', 
                         study_id_name = 'fake_study_id' )

   ### (2) Avoid the warning by creating 'x' as numeric instead of integer:
   fake_data_02 = fake_data_01;
   fake_data_02$x <- as.numeric( fake_data_02$x ) # explicitly set to 'numeric'
   checked_data_02 = check_study_data_frame( 
                         fake_data_02,
                         group_name = 'grp',
                         subject_ID = 'ID',
                         x_name = 'x',
                         endpoint_name = 'resp',
                         study_id_name = 'fake_study_id' )
 
## End(Not run)
  

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.