Description Usage Arguments Details Value Note References Examples
View source: R/ca-scoreFACT_Hep.R
Generates all of the scores of the Functional Assessment of Cancer Therapy - Hepatobiliary Cancer (FACT-Hep, v4) from item responses.
1  | scoreFACT_Hep(df, updateItems = FALSE, keepNvalid = FALSE)
 | 
df | 
 A data frame with the FACT-Hep items, appropriately-named.  | 
updateItems | 
 Logical, if   | 
keepNvalid | 
 Logical, if   | 
Given a data frame that includes all of the FACT-Hep (Version 4) items as variables, appropriately named, this function generates all of the FACT-Hep scale scores. It is crucial that the item variables in the supplied data frame are named according to FACT conventions. For example, the first physical well-being item should be named GP1, the second GP2, and so on. Please refer to the materials provided by http://www.facit.org for the particular questionnaire you are using. In particular, refer to the left margin of the official questionnaire (i.e., from facit.org) for the appropriate item variable names.
The original data frame is returned (optionally with modified
items if updateItems = TRUE) with new variables corresponding to
the scored scales. If keepNvalid = TRUE, for each scored scale an
additional variable is returned that contains the number of valid
responses each respondent made to the items making up the given scale.
These optional variables have names of the format SCALENAME_N.
The following scale scores are returned:
Physical Well-Being subscale
Social/Family Well-Being subscale
Emotional Well-Being subscale
Physical Well-Being subscale
FACT-G Total Score (i.e., PWB+SWB+EWB+FWB)
Hepatobiliary Cancer subscale
FACT-Hep Total Score (i.e., PWB+SWB+EWB+FWB+HCS)
FACT-Hep Trial Outcome Index (e.g., PWB+FWB+HCS)
Keep in mind that this function (and R in general) is case-sensitive.
All variables should be in numeric or integer format.
This scoring function expects missing item responses to be coded as NA, 8, or 9, and valid item responses to be coded as 0, 1, 2, 3, or 4. Any other value for any of the items will result in an error message and no scores.
Some item variables are reverse coded for the purpose of generating the
scale scores.  The official (e.g., from http://www.facit.org) SAS
and SPSS scoring algorithms for this questionnaire automatically replace
the original items with their reverse-coded versions.  This can be
confusing if you accidentally run the algorithm more than once on your
data.  As its default, scoreFACT_Hep DOES NOT replace any of your
original item variables with the reverse coded versions.  However, for
consistentcy with the behavior of the other versions on
http://www.facit.org, the updateItems argument is
provided.  If set to TRUE, any item that is supposed to be
reverse coded will be replaced with its reversed version in the data
frame returned by scoreFACT_Hep.
FACT-Hep Scoring Guidelines, available at http://www.facit.org
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 33 34 35 36  | ## Setting up item names for fake data
G_names <- c(paste0('GP', 1:7),
             paste0('GS', 1:7),
             paste0('GE', 1:6),
             paste0('GF', 1:7))
AC_names <- c('C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'Hep1', 'Cns7', 'Cx6', 'HI7', 'An7', 'Hep2',
  'Hep3', 'Hep4', 'Hep5', 'Hep6', 'HN2', 'Hep8')
itemNames <- c(G_names, AC_names)
## Generating random item responses for 8 fake respondents
set.seed(6375309)
exampleDat <- t(replicate(8, sample(0:4, size = length(itemNames), replace = TRUE)))
## Making half of respondents missing about 10% of items,
## half missing about 50%.
miss10 <- t(replicate(4, sample(c(0, 9), prob = c(0.9, 0.1),
    size = length(itemNames), replace = TRUE)))
miss50 <- t(replicate(4, sample(c(0, 9), prob = c(0.5, 0.5),
    size = length(itemNames), replace = TRUE)))
missMtx <- rbind(miss10, miss50)
## Using 9 as the code for missing responses
exampleDat[missMtx == 9] <- 9
exampleDat <- as.data.frame(cbind(ID = paste0('ID', 1:8),
    as.data.frame(exampleDat)))
names(exampleDat) <- c('ID', itemNames)
## Returns data frame with scale scores and with original items untouched
scoredDat <- scoreFACT_Hep(exampleDat)
names(scoredDat)
scoredDat
## Returns data frame with scale scores, with the appropriate items
## reverse scored, and with item values of 8 and 9 replaced with NA.
## Also illustrates the effect of setting keepNvalid = TRUE.
scoredDat <- scoreFACT_Hep(exampleDat, updateItems = TRUE, keepNvalid = TRUE)
names(scoredDat)
## Descriptives of scored scales
summary(scoredDat[, c('PWB', 'SWB', 'EWB', 'FWB', 'FACTG',
                      'HCS', 'FACT_Hep_TOTAL', 'FACT_Hep_TOI')])
 | 
 [1] "ID"             "GP1"            "GP2"            "GP3"           
 [5] "GP4"            "GP5"            "GP6"            "GP7"           
 [9] "GS1"            "GS2"            "GS3"            "GS4"           
[13] "GS5"            "GS6"            "GS7"            "GE1"           
[17] "GE2"            "GE3"            "GE4"            "GE5"           
[21] "GE6"            "GF1"            "GF2"            "GF3"           
[25] "GF4"            "GF5"            "GF6"            "GF7"           
[29] "C1"             "C2"             "C3"             "C4"            
[33] "C5"             "C6"             "Hep1"           "Cns7"          
[37] "Cx6"            "HI7"            "An7"            "Hep2"          
[41] "Hep3"           "Hep4"           "Hep5"           "Hep6"          
[45] "HN2"            "Hep8"           "PWB"            "SWB"           
[49] "EWB"            "FWB"            "FACTG"          "HCS"           
[53] "FACT_Hep_TOTAL" "FACT_Hep_TOI"  
   ID GP1 GP2 GP3 GP4 GP5 GP6 GP7 GS1 GS2 GS3 GS4 GS5 GS6 GS7 GE1 GE2 GE3 GE4
1 ID1   3   3   1   2   9   9   0   1   2   1   1   1   0   2   0   2   0   2
2 ID2   1   2   1   9   0   3   4   9   0   3   3   3   2   0   2   2   3   3
3 ID3   2   1   0   4   3   3   0   2   1   1   2   3   4   4   0   1   1   2
4 ID4   1   4   3   4   2   9   1   9   2   1   1   0   0   1   1   1   1   9
5 ID5   9   9   9   1   2   9   9   2   9   9   3   9   0   2   9   9   0   9
6 ID6   4   0   1   9   4   9   2   2   9   9   0   3   2   2   2   9   9   2
7 ID7   9   1   2   9   0   9   9   4   3   3   9   4   9   9   9   9   9   9
8 ID8   9   9   9   9   3   0   9   2   9   0   3   0   2   9   9   4   9   2
  GE5 GE6 GF1 GF2 GF3 GF4 GF5 GF6 GF7 C1 C2 C3 C4 C5 C6 Hep1 Cns7 Cx6 HI7 An7
1   4   3   0   3   2   0   1   2   2  4  2  1  2  3  9    4    4   4   3   0
2   4   4   0   0   3   3   3   2   3  3  2  3  9  0  2    4    0   2   2   2
3   0   4   0   3   2   3   2   4   3  3  1  1  1  4  1    2    0   2   9   2
4   3   9   3   2   0   0   9   3   9  3  0  0  0  0  0    1    3   3   3   0
5   2   9   9   1   9   9   9   9   3  9  1  0  3  9  2    1    9   9   9   9
6   0   9   9   4   9   0   9   4   9  9  4  9  9  9  3    1    9   3   1   9
7   2   9   3   9   9   4   0   4   9  9  9  2  1  9  2    9    3   0   9   0
8   0   4   9   0   9   3   2   2   3  3  3  9  4  9  3    9    9   9   1   3
  Hep2 Hep3 Hep4 Hep5 Hep6 HN2 Hep8    PWB    SWB EWB   FWB FACTG    HCS
1    4    3    2    9    2   2    3 15.400  8.000  13 10.00  46.4 16.875
2    1    0    0    3    9   2    2 15.167 12.833   6 14.00  48.0 42.750
3    2    2    3    9    4   2    1 15.000 17.000  14 17.00  63.0 30.375
4    4    4    4    1    2   4    0 10.500  5.833  12 11.20    NA 24.000
5    4    2    9    0    9   1    2     NA 12.250  NA    NA    NA 39.600
6    4    3    9    0    9   4    4 12.600 12.600  NA    NA    NA 27.000
7    4    4    9    9    2   9    1     NA 24.500  NA 19.25    NA 27.000
8    1    4    9    9    9   9    1     NA  9.800  15 14.00    NA     NA
  FACT_Hep_TOTAL FACT_Hep_TOI
1         63.275       42.275
2         90.750       71.917
3         93.375       62.375
4         63.533       45.700
5             NA           NA
6             NA           NA
7             NA           NA
8             NA           NA
 [1] "ID"               "GP1"              "GP2"              "GP3"             
 [5] "GP4"              "GP5"              "GP6"              "GP7"             
 [9] "GS1"              "GS2"              "GS3"              "GS4"             
[13] "GS5"              "GS6"              "GS7"              "GE1"             
[17] "GE2"              "GE3"              "GE4"              "GE5"             
[21] "GE6"              "GF1"              "GF2"              "GF3"             
[25] "GF4"              "GF5"              "GF6"              "GF7"             
[29] "C1"               "C2"               "C3"               "C4"              
[33] "C5"               "C6"               "HEP1"             "CNS7"            
[37] "CX6"              "HI7"              "AN7"              "HEP2"            
[41] "HEP3"             "HEP4"             "HEP5"             "HEP6"            
[45] "HN2"              "HEP8"             "PWB_N"            "SWB_N"           
[49] "EWB_N"            "FWB_N"            "FACTG_N"          "PWB"             
[53] "SWB"              "EWB"              "FWB"              "FACTG"           
[57] "HCS_N"            "FACT_Hep_TOTAL_N" "HCS"              "FACT_Hep_TOTAL"  
[61] "FACT_Hep_TOI"    
      PWB             SWB              EWB          FWB            FACTG      
 Min.   :10.50   Min.   : 5.833   Min.   : 6   Min.   :10.00   Min.   :46.40  
 1st Qu.:12.60   1st Qu.: 9.350   1st Qu.:12   1st Qu.:11.90   1st Qu.:47.20  
 Median :15.00   Median :12.425   Median :13   Median :14.00   Median :48.00  
 Mean   :13.73   Mean   :12.852   Mean   :12   Mean   :14.24   Mean   :52.47  
 3rd Qu.:15.17   3rd Qu.:13.875   3rd Qu.:14   3rd Qu.:16.25   3rd Qu.:55.50  
 Max.   :15.40   Max.   :24.500   Max.   :15   Max.   :19.25   Max.   :63.00  
 NA's   :3                        NA's   :3    NA's   :2       NA's   :5      
      HCS        FACT_Hep_TOTAL   FACT_Hep_TOI  
 Min.   :16.88   Min.   :63.27   Min.   :42.27  
 1st Qu.:25.50   1st Qu.:63.47   1st Qu.:44.84  
 Median :27.00   Median :77.14   Median :54.04  
 Mean   :29.66   Mean   :77.73   Mean   :55.57  
 3rd Qu.:34.99   3rd Qu.:91.41   3rd Qu.:64.76  
 Max.   :42.75   Max.   :93.38   Max.   :71.92  
 NA's   :1       NA's   :4       NA's   :4      
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.