| Title: | PEDALFAST Data |
|---|---|
| Description: | Data files and documentation for PEDiatric vALidation oF vAriableS in TBI (PEDALFAST). The data was used in "Functional Status Scale in Children With Traumatic Brain Injury: A Prospective Cohort Study" by Bennett, Dixon, et al (2016) <doi:10.1097/PCC.0000000000000934>. |
| Authors: | Peter DeWitt [aut, cre]
|
| Maintainer: | Peter DeWitt <[email protected]> |
| License: | GPL-2 |
| Version: | 1.0.2 |
| Built: | 2026-05-11 09:21:02 UTC |
| Source: | https://github.com/cran/pedalfast.data |
Mapping FSS Total scores (integer values) to categorical values.
fss_as_factor(x, long_label = FALSE, ...)fss_as_factor(x, long_label = FALSE, ...)
x |
an integer vector |
long_label |
logical if the score range should be prepended to the label. |
... |
not currently used. |
FSS scores are integer values from 6 to 30.
The a mapping of ranges of integer values to categories is
FSS 6, 7: Good
FSS 8, 9: Mildly abnormal
FSS 10, 11, 12, 13, 14, 15: Moderately abnormal
FSS 16, 17, 18, 19, 20, 21: Severe abnormal
FSS 22, 23, 24, 25, 26, 27, 28, 29, 30: Very severely abnormal
A factor of equal length to the input x with labels for the
categorical ranges of FSS.
x <- seq(5, 32) data.frame(x = x, short_label = fss_as_factor(x), long_label = fss_as_factor(x, long_label = TRUE))x <- seq(5, 32) data.frame(x = x, short_label = fss_as_factor(x), long_label = fss_as_factor(x, long_label = TRUE))
Functions for mapping integer values to GCS labeled factor and visa versa
gcs_as_integer(x, scale, ...) ## S3 method for class 'factor' gcs_as_integer(x, scale, ...) ## S3 method for class 'character' gcs_as_integer(x, scale, ...) gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) ## S3 method for class 'character' gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) ## S3 method for class 'numeric' gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) gcs_llgcs_as_integer(x, scale, ...) ## S3 method for class 'factor' gcs_as_integer(x, scale, ...) ## S3 method for class 'character' gcs_as_integer(x, scale, ...) gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) ## S3 method for class 'character' gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) ## S3 method for class 'numeric' gcs_as_factor(x, scale, long_label = FALSE, highest_first = FALSE, ...) gcs_ll
x |
a integer, factor, or character vector. |
scale |
a character string to denote eye, motor, or verbal GCS scale. |
... |
not currently used. |
long_label |
logical to prepend the numeric value to the label of a factor. |
highest_first |
logical if the factor levels should be ordered with the highest GCS score as the reference level, else the lowest GCS score as the reference level. |
An object of class list of length 3.
gcs_as_factor returns a factor of equal length to x.
gcs_as_integer returns an integer vector of equal length to x.
######################################## # Mapping from numeric values to factor: nums <- c(0:7, 2.3) # with short labels data.frame(nums = nums, eye = gcs_as_factor(nums, scale = "eye"), motor = gcs_as_factor(nums, scale = "motor"), verbal = gcs_as_factor(nums, scale = "verbal")) # with long labels data.frame(nums = nums, eye = gcs_as_factor(nums, scale = "eye", long_label = TRUE), motor = gcs_as_factor(nums, scale = "motor", long_label = TRUE), verbal = gcs_as_factor(nums, scale = "verbal", long_label = TRUE)) ################################################### # Mapping from factors/characters to numeric values # A quick way to access the labels and numeric values pedalfast.data::gcs_ll all_levels <- do.call(c, lapply(pedalfast.data::gcs_ll, names)) data.frame(lvls = all_levels, eye = gcs_as_integer(all_levels, scale = "eye"), motor = gcs_as_integer(all_levels, scale = "motor"), verbal = gcs_as_integer(all_levels, scale = "verbal") ) ################################################## # Order of the levels: # The data values are the same, but the order of the levels differs. gcs_as_factor(1:4, "eye", highest_first = FALSE) gcs_as_factor(1:4, "eye", highest_first = TRUE)######################################## # Mapping from numeric values to factor: nums <- c(0:7, 2.3) # with short labels data.frame(nums = nums, eye = gcs_as_factor(nums, scale = "eye"), motor = gcs_as_factor(nums, scale = "motor"), verbal = gcs_as_factor(nums, scale = "verbal")) # with long labels data.frame(nums = nums, eye = gcs_as_factor(nums, scale = "eye", long_label = TRUE), motor = gcs_as_factor(nums, scale = "motor", long_label = TRUE), verbal = gcs_as_factor(nums, scale = "verbal", long_label = TRUE)) ################################################### # Mapping from factors/characters to numeric values # A quick way to access the labels and numeric values pedalfast.data::gcs_ll all_levels <- do.call(c, lapply(pedalfast.data::gcs_ll, names)) data.frame(lvls = all_levels, eye = gcs_as_integer(all_levels, scale = "eye"), motor = gcs_as_integer(all_levels, scale = "motor"), verbal = gcs_as_integer(all_levels, scale = "verbal") ) ################################################## # Order of the levels: # The data values are the same, but the order of the levels differs. gcs_as_factor(1:4, "eye", highest_first = FALSE) gcs_as_factor(1:4, "eye", highest_first = TRUE)
Turns Yes/No variables into 1/0 integers
onezero(x)onezero(x)
x |
a character vector |
The input is forced to lowercase and only the first character, the "y" or "n", is used to map to the 1/0 integer values. The function allows for "1" and "0" to be in the character vector as well.
an integer vector
flag <- c("Y", "No", "NO", "no", "n", "YES", "Yes", "yEs", "1", "0") onezero(flag)flag <- c("Y", "No", "NO", "no", "n", "YES", "Yes", "yEs", "1", "0") onezero(flag)
Single data frame for the PEDALFAST data.
pedalfastpedalfast
An object of class data.frame with 388 rows and 103 columns.
pedalfast is one data frame with the whole of the exported data.
vignette("datasets", package = "pedalfast.data")
A flavor of the base function factor but aimed to use specific default values
for levels and labels based on the information in the
pedalfast_metadata object.
pedalfast_factor(x, variable, label_with_level = FALSE, ...)pedalfast_factor(x, variable, label_with_level = FALSE, ...)
x |
a vector of data |
variable |
character string identifying the variable name in
|
label_with_level |
(default to FALSE) labels will include the integer value. See examples. |
... |
not currently used. |
An object of class factor
Bennett TD, Dixon RR, Kartchner C, DeWitt PE, Sierra Y, Ladell D, Kempe A, Runyan DK, Dean JM, Keenan HT. Functional Status Scale in Children With Traumatic Brain Injury: A Prospective Cohort Study. Pediatr Crit Care Med. 2016 Dec;17(12):1147-1156. doi: 10.1097/PCC.0000000000000934. PMID: 27753754; PMCID: PMC5138132.
Pollack MM, Holubkov R, Funai T, et al. Pediatric intensive care outcomes: development of new morbidities during pediatric critical care. Pediatr Crit Care Med. 2014;15(9):821-827. doi:10.1097/PCC.0000000000000250
data(pedalfast, pedalfast_metadata, package = "pedalfast.data") # The Motor GCS in the emergency department is reported as an integer value. str(pedalfast$gcsmotored) # Each integer value a specific meaning pedalfast_metadata[grepl("gcsmotored", pedalfast_metadata$variable), ] # Creating the factor in base R pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored") pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored", label_with_level = TRUE)data(pedalfast, pedalfast_metadata, package = "pedalfast.data") # The Motor GCS in the emergency department is reported as an integer value. str(pedalfast$gcsmotored) # Each integer value a specific meaning pedalfast_metadata[grepl("gcsmotored", pedalfast_metadata$variable), ] # Creating the factor in base R pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored") pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored", label_with_level = TRUE)
pedalfast_metadata provides documentation for each of variables in the
pedalfast.
pedalfast_metadatapedalfast_metadata
An object of class data.frame with 103 rows and 3 columns.
vignette("datasets", package = "pedalfast.data")
Round age per FITBIR guidelines
round_age(x, type = "character")round_age(x, type = "character")
x |
a numeric vector |
type |
defaults to |
FITBIR Definition for the "AgeYrs" data element: Value for participant's subject age, calculated as elapsed time since the birth of the participant/subject in years. The subjects age is typically recorded to the nearest full year completed, e.g. 11 years and 6 months should be recorded as 11 years.
Guidelines & Instructions: The subject's age is typically recorded to the nearest full year completed, e.g. 11 years and 6 months should be recorded as 11 years. For subject's which are under 1 year old, use decimal points and use the following convention- record 1 month as 0.083 (1/12), 2 months as 0.166 (2/12), 3 months as 0.25 (3/12), 4 months as 0.333 (4/12), 5 months as 0.416 (5/12), 6 months as 0.5 (6/12), 7 months as 0.583 (7/12), 8 months as 0.666 (8/12), 9 months as 0.75 (9/12), 10 months as 0.833 (10/12), 11 months as 0.916 (11/12) and 12 months as 1 year. For the individuals 90 or older, in order to preserve PII, please submit "150" and make a note this in the "general notes" column.
a character or numeric vector depending on the value of type.
ages <- c(92, 12.12, 89 + 10/12, 9.12, 9.73, 1.1, 1.75, ( 1:11 + 0.05 ) / 12, 2, 90) round_age(ages) round_age(ages, "numeric")ages <- c(92, 12.12, 89 + 10/12, 9.12, 9.73, 1.1, 1.75, ( 1:11 + 0.05 ) / 12, 2, 90) round_age(ages) round_age(ages, "numeric")
Turns 1/0 into "Yes"/"No"
yesno(x)yesno(x)
x |
an integer vector |
a character vector
flag <- c(0, 1, 1, 0, 0, 0) yesno(flag)flag <- c(0, 1, 1, 0, 0, 0) yesno(flag)