# Introduction to the `capl` R package

#### Joel D. Barnes, M.Sc. and Michelle D. Guerrero, Ph.D.

#### March 25, 2022

## Introduction

The Canadian Assessment of Physical Literacy (CAPL) is the first comprehensive protocol that can accurately and reliably assess a broad spectrum of skills and abilities that contribute to and characterize the physical literacy level of a participating child.

Physical literacy moves beyond just fitness, motor skill or motivation in isolation. The CAPL is unique in that it can assess the multiple aspects of physical literacy: physical competence, daily behaviour, motivation and confidence, and knowledge and understanding.

The domains of physical literacy are summarized in figure 1 of the CAPL-2 manual on page 6:

The Healthy Active Living and Obesity Research Group (HALO) has been responsible for the systematic development of the CAPL since 2008. HALO’s test development efforts have been informed by the assessment of more than 10,000 children and with input from well over 100 researchers and practitioners within related fields of study.

The `capl` package contains tools enabling users to compute and visualize CAPL-2 (Canadian Assessment of Physical Literacy, Second Edition) scores and interpretations from raw data, all within the R environment without having to use the CAPL-2 website.

## Installation

### GitHub

Users can download and install the most recent version of the `capl` package directly from GitHub (www.github.com/barnzilla/capl) using the `devtools` R package.

    devtools::install_github("barnzilla/capl", upgrade = "never", build_vignettes = TRUE, force = TRUE)
    library(capl)

Once the `capl` package is loaded, any available tutorials for the package, such as this vignette, can be accessed by calling the `browseVignettes()` function.

    browseVignettes("capl")

## Getting started

### Importing raw data

Users must first import their raw data before using the `capl` package to compute CAPL-2 scores and interpretations. The `import_capl_data()` function enables users to import data from an Excel workbook into the R global environment.

    data <- import_capl_data(
      file_path = "c:/path/to/raw-data.xlsx",
      sheet_name = "Sheet1"
    )

### Required variables

The `capl` package requires 60 variables in order to compute CAPL-2 scores and interpretations. Users can use the `get_missing_capl_variables()` function to retrieve a list of the required variables. The required variables are outlined in the Details section of the documentation.

    ?get_missing_capl_variables

The `capl` package is looking for 60 variables by the following names:

- `age`
- `gender`
- `pacer_lap_distance`
- `pacer_laps`
- `plank_time`
- `camsa_skill_score1`
- `camsa_time1`
- `camsa_skill_score2`
- `camsa_time2`
- `steps1`
- `time_on1`
- `time_off1`
- `non_wear_time1`
- `steps2`
- `time_on2`
- `time_off2`
- `non_wear_time2`
- `steps3`
- `time_on3`
- `time_off3`
- `non_wear_time3`
- `steps4`
- `time_on4`
- `time_off4`
- `non_wear_time4`
- `steps5`
- `time_on5`
- `time_off5`
- `non_wear_time5`
- `steps6`
- `time_on6`
- `time_off6`
- `non_wear_time6`
- `steps7`
- `time_on7`
- `time_off7`
- `non_wear_time7`
- `self_report_pa`
- `csappa1`
- `csappa2`
- `csappa3`
- `csappa4`
- `csappa5`
- `csappa6`
- `why_active1`
- `why_active2`
- `why_active3`
- `feelings_about_pa1`
- `feelings_about_pa2`
- `feelings_about_pa3`
- `pa_guideline`
- `crf_means`
- `ms_means`
- `sports_skill`
- `pa_is`
- `pa_is_also`
- `improve`
- `increase`
- `when_cooling_down`
- `heart_rate`

### Loading the pre-installed dataset

The `capl` package comes with a demo (fake) dataset of raw data, `capl_demo_data`, which contains 500 rows of participant data on the 60 variables that are required by the `capl` package. Users can load the demo dataset and start exploring.

    data("capl_demo_data")

The base R `str()` function allows users to get a sense of how the CAPL-2 raw data should be structured and named for downstream use in the `capl` package.

    str(capl_demo_data)
    #> 'data.frame':    500 obs. of  60 variables:
    #>  $ age               : int  8 9 9 8 12 10 12 10 12 9 ...
    #>  $ gender            : chr  "Male" "Female" "Male" "f" ...
    #>  $ pacer_lap_distance: num  15 20 20 15 20 15 15 15 15 NA ...
    #>  $ pacer_laps        : int  23 31 169 50 63 15 32 143 43 182 ...
    #>  $ plank_time        : int  274 282 9 228 252 110 21 185 6 41 ...
    #>  $ camsa_skill_score1: int  14 5 6 13 2 9 4 11 5 11 ...
    #>  $ camsa_time1       : int  34 27 13 35 21 NA NA 16 20 14 ...
    #>  $ camsa_skill_score2: int  14 5 13 11 14 14 0 4 0 4 ...
    #>  $ camsa_time2       : int  35 23 14 35 23 23 33 30 29 18 ...
    #>  $ steps1            : int  30627 27788 8457 8769 14169 9610 29459 17112 30008 18270 ...
    #>  $ time_on1          : chr  "5:13am" "6:13" "6:07" "6:13" ...
    #>  $ time_off1         : chr  "22:00" NA "21:00" "22:00" ...
    #>  $ non_wear_time1    : int  25 31 33 25 83 67 20 10 49 64 ...
    #>  $ steps2            : int  14905 24750 30111 21077 15786 23828 24735 2621 20690 19652 ...
    #>  $ time_on2          : chr  "06:00" "5:13am" "6:13" "6:13" ...
    #>  $ time_off2         : chr  "21:00" "23:00" "11:13pm" "23:00" ...
    #>  $ non_wear_time2    : int  20 82 4 55 1 53 65 47 82 79 ...
    #>  $ steps3            : int  21972 15827 14130 13132 18022 12817 14065 26352 27090 10226 ...
    #>  $ time_on3          : chr  "07:00" "05:00" "07:48am" NA ...
    #>  $ time_off3         : chr  "11:57pm" NA "08:30pm" NA ...
    #>  $ non_wear_time3    : int  6 79 23 65 34 15 72 76 60 40 ...
    #>  $ steps4            : int  28084 27369 14315 9963 6993 10092 10774 3208 2878 9055 ...
    #>  $ time_on4          : chr  "05:00" "6:13" "6:07" NA ...
    #>  $ time_off4         : chr  "08:30pm" "10:57 pm" "22:00" "11:13pm" ...
    #>  $ non_wear_time4    : int  32 38 74 20 75 22 84 59 42 22 ...
    #>  $ steps5            : int  14858 21112 16880 11707 20917 30200 20220 17995 18712 25336 ...
    #>  $ time_on5          : chr  "6:07" "6:13" "06:00" "05:00" ...
    #>  $ time_off5         : chr  "11:57pm" "23:00" "8:17pm" "8:17pm" ...
    #>  $ non_wear_time5    : int  61 64 73 23 82 42 66 38 55 18 ...
    #>  $ steps6            : int  17705 5564 16459 12235 27766 26099 15763 7202 2746 3895 ...
    #>  $ time_on6          : chr  "06:00" "06:00" NA "6:07" ...
    #>  $ time_off6         : chr  "21:00" NA "10:57 pm" "08:30pm" ...
    #>  $ non_wear_time6    : int  33 24 89 8 27 56 66 21 14 7 ...
    #>  $ steps7            : int  11067 13540 12106 18795 15039 9082 3733 4029 20791 28499 ...
    #>  $ time_on7          : chr  "6:07" "6:07" "8:00am" "06:00" ...
    #>  $ time_off7         : chr  "08:30pm" "11:13pm" "8:17pm" "10:57 pm" ...
    #>  $ non_wear_time7    : int  8 72 4 38 9 32 49 36 34 43 ...
    #>  $ self_report_pa    : int  NA 2 2 4 3 5 NA 7 6 7 ...
    #>  $ csappa1           : int  1 2 4 2 2 2 3 2 2 3 ...
    #>  $ csappa2           : int  3 2 1 1 1 1 4 1 4 3 ...
    #>  $ csappa3           : int  2 3 2 1 NA 1 3 3 4 4 ...
    #>  $ csappa4           : int  4 1 1 3 4 4 4 4 4 1 ...
    #>  $ csappa5           : int  4 2 3 2 1 2 2 2 4 1 ...
    #>  $ csappa6           : int  3 4 1 4 2 2 2 3 4 4 ...
    #>  $ why_active1       : int  4 3 5 3 1 5 4 1 1 2 ...
    #>  $ why_active2       : int  5 3 4 2 5 3 5 NA 5 NA ...
    #>  $ why_active3       : int  3 3 1 4 2 3 4 4 5 3 ...
    #>  $ feelings_about_pa1: int  4 3 2 2 1 1 3 4 4 2 ...
    #>  $ feelings_about_pa2: int  5 2 2 3 4 2 4 4 2 5 ...
    #>  $ feelings_about_pa3: int  2 5 2 5 3 2 2 1 3 5 ...
    #>  $ pa_guideline      : int  2 3 4 1 2 4 3 2 2 2 ...
    #>  $ crf_means         : int  1 4 4 2 2 1 2 1 4 1 ...
    #>  $ ms_means          : int  3 2 1 2 3 1 1 2 4 2 ...
    #>  $ sports_skill      : int  2 4 4 1 3 1 3 1 4 3 ...
    #>  $ pa_is             : int  10 1 1 1 1 1 2 1 3 1 ...
    #>  $ pa_is_also        : int  5 1 4 4 1 7 2 7 2 8 ...
    #>  $ improve           : int  3 3 9 3 9 9 3 3 3 6 ...
    #>  $ increase          : int  2 8 3 8 8 1 3 3 8 8 ...
    #>  $ when_cooling_down : int  4 2 4 2 2 2 2 5 2 2 ...
    #>  $ heart_rate        : int  5 6 4 4 4 9 4 8 7 4 ...

The 60 required variables can also be quickly accessed by calling the base R `colnames()` function.

    colnames(capl_demo_data)
    #>  [1] "age"                "gender"             "pacer_lap_distance"
    #>  [4] "pacer_laps"         "plank_time"         "camsa_skill_score1"
    #>  [7] "camsa_time1"        "camsa_skill_score2" "camsa_time2"
    #> [10] "steps1"             "time_on1"           "time_off1"
    #> [13] "non_wear_time1"     "steps2"             "time_on2"
    #> [16] "time_off2"          "non_wear_time2"     "steps3"
    #> [19] "time_on3"           "time_off3"          "non_wear_time3"
    #> [22] "steps4"             "time_on4"           "time_off4"
    #> [25] "non_wear_time4"     "steps5"             "time_on5"
    #> [28] "time_off5"          "non_wear_time5"     "steps6"
    #> [31] "time_on6"           "time_off6"          "non_wear_time6"
    #> [34] "steps7"             "time_on7"           "time_off7"
    #> [37] "non_wear_time7"     "self_report_pa"     "csappa1"
    #> [40] "csappa2"            "csappa3"            "csappa4"
    #> [43] "csappa5"            "csappa6"            "why_active1"
    #> [46] "why_active2"        "why_active3"        "feelings_about_pa1"
    #> [49] "feelings_about_pa2" "feelings_about_pa3" "pa_guideline"
    #> [52] "crf_means"          "ms_means"           "sports_skill"
    #> [55] "pa_is"              "pa_is_also"         "improve"
    #> [58] "increase"           "when_cooling_down"  "heart_rate"

### Generating demo raw data

The `capl` package is also equipped with the `get_capl_demo_data()` function. This function allows users to randomly generate demo raw data and takes parameter `n` (set to 500 by default). This parameter is used to specify how many rows of demo raw data to generate and must, therefore, be an integer greater than zero. Users, for example, can randomly generate demo raw data for 10,000 participants by executing a single line of code:

    capl_demo_data2 <- get_capl_demo_data(n = 10000)

The base R `str()` function can be called to verify how many rows and columns of data were created.

    str(capl_demo_data2)
    #> 'data.frame':    10000 obs. of  60 variables:
    #>  $ age               : int  12 11 11 11 7 11 10 10 12 10 ...
    #>  $ gender            : chr  "f" "Girl" "Boy" "Female" ...
    #>  $ pacer_lap_distance: num  20 20 15 15 20 15 NA 15 20 15 ...
    #>  $ pacer_laps        : int  194 194 6 136 108 141 175 55 115 33 ...
    #>  $ plank_time        : int  15 24 97 77 243 261 285 119 35 232 ...
    #>  $ camsa_skill_score1: int  9 9 5 7 9 8 4 4 14 6 ...
    #>  $ camsa_time1       : int  30 18 11 22 20 16 27 17 12 26 ...
    #>  $ camsa_skill_score2: int  5 NA 9 6 7 13 9 3 10 8 ...
    #>  $ camsa_time2       : int  26 20 27 30 15 31 18 26 24 12 ...
    #>  $ steps1            : int  8956 6296 28534 13681 7921 27379 3682 11291 14083 6010 ...
    #>  $ time_on1          : chr  "07:00" NA "6:07" "6:13" ...
    #>  $ time_off1         : chr  "11:57pm" "21:00" "22:00" "11:57pm" ...
    #>  $ non_wear_time1    : int  64 25 47 21 66 47 1 90 36 79 ...
    #>  $ steps2            : int  13288 24332 8247 29195 18082 26848 13019 28029 2290 8498 ...
    #>  $ time_on2          : chr  "06:00" "5:13am" "05:00" "07:48am" ...
    #>  $ time_off2         : chr  "22:00" "21:00" "08:30pm" "11:13pm" ...
    #>  $ non_wear_time2    : int  82 25 41 63 28 14 48 65 4 54 ...
    #>  $ steps3            : int  30337 16486 19251 24376 6181 2794 22925 7834 3685 14526 ...
    #>  $ time_on3          : chr  "6:07" "06:00" "07:48am" "8:00am" ...
    #>  $ time_off3         : chr  "8:17pm" "22:00" "08:30pm" "10:57 pm" ...
    #>  $ non_wear_time3    : int  50 0 42 77 22 44 28 31 13 20 ...
    #>  $ steps4            : int  12491 28605 18313 2136 19644 26878 7157 2182 21941 9769 ...
    #>  $ time_on4          : chr  "5:13am" "8:00am" "5:13am" "05:00" ...
    #>  $ time_off4         : chr  "22:00" NA "10:57 pm" "23:00" ...
    #>  $ non_wear_time4    : int  72 71 19 52 81 40 82 20 36 3 ...
    #>  $ steps5            : int  9149 1599 17696 16316 14286 30330 20326 24706 11135 17383 ...
    #>  $ time_on5          : chr  "06:00" "6:07" "8:00am" "5:13am" ...
    #>  $ time_off5         : chr  "21:00" "11:57pm" "10:57 pm" "10:57 pm" ...
    #>  $ non_wear_time5    : int  6 29 7 71 76 79 82 4 1 18 ...
    #>  $ steps6            : int  15240 22719 14439 20137 22746 22500 7315 8295 17142 12305 ...
    #>  $ time_on6          : chr  "07:48am" "5:13am" "07:00" "05:00" ...
    #>  $ time_off6         : chr  "11:13pm" "21:00" NA NA ...
    #>  $ non_wear_time6    : int  18 48 60 66 15 41 9 NA 22 8 ...
    #>  $ steps7            : int  10810 11607 28089 6269 29530 13824 23614 25367 25992 25336 ...
    #>  $ time_on7          : chr  "6:07" "8:00am" "07:48am" "8:00am" ...
    #>  $ time_off7         : chr  "8:17pm" "22:00" "23:00" "11:13pm" ...
    #>  $ non_wear_time7    : int  13 39 65 90 12 1 61 55 58 68 ...
    #>  $ self_report_pa    : int  2 6 5 NA 6 6 2 1 2 1 ...
    #>  $ csappa1           : int  2 4 2 2 4 4 3 4 2 2 ...
    #>  $ csappa2           : int  3 3 2 1 4 3 2 4 2 4 ...
    #>  $ csappa3           : int  1 4 4 2 2 2 4 2 4 3 ...
    #>  $ csappa4           : int  3 3 1 4 3 1 3 3 3 4 ...
    #>  $ csappa5           : int  1 1 2 2 3 4 1 1 3 1 ...
    #>  $ csappa6           : int  2 1 3 1 3 2 2 2 4 1 ...
    #>  $ why_active1       : int  3 2 1 5 5 1 2 3 3 4 ...
    #>  $ why_active2       : int  5 2 2 3 1 2 1 1 5 1 ...
    #>  $ why_active3       : int  3 1 1 4 NA NA 4 NA 3 1 ...
    #>  $ feelings_about_pa1: int  4 1 1 2 4 3 2 5 2 3 ...
    #>  $ feelings_about_pa2: int  2 2 3 5 3 3 4 1 1 4 ...
    #>  $ feelings_about_pa3: int  1 3 1 NA 4 3 3 5 4 2 ...
    #>  $ pa_guideline      : int  1 1 4 4 1 4 1 3 1 1 ...
    #>  $ crf_means         : int  3 1 3 1 3 2 1 4 4 3 ...
    #>  $ ms_means          : int  1 2 4 1 2 3 3 3 4 1 ...
    #>  $ sports_skill      : int  1 1 3 4 3 2 3 4 1 2 ...
    #>  $ pa_is             : int  2 7 3 7 8 3 1 4 1 5 ...
    #>  $ pa_is_also        : int  5 7 2 7 7 2 9 10 10 5 ...
    #>  $ improve           : int  3 3 1 5 3 2 9 2 3 1 ...
    #>  $ increase          : int  2 8 8 1 4 2 8 4 8 1 ...
    #>  $ when_cooling_down : int  2 4 2 3 2 2 2 2 10 10 ...
    #>  $ heart_rate        : int  4 3 8 7 4 10 9 4 4 9 ...

### Exporting data to Excel

If users prefer to examine the CAPL demo raw data in a workbook, the `export_capl_data()` function allows them to export data objects to Excel.

    export_capl_data(capl_demo_data2, "c:/path/to/store/capl_demo_data2.xlsx")

### Renaming variables

If users have imported their own raw data and plan to use the main function, `get_capl()`, in the `capl` package to compute CAPL-2 scores and interpretations, they must ensure their variables names match the names of the 60 required variables. Users can rename their variables by calling the `rename_variable()` function. This function takes three parameters: `x`, `search`, and `replace`. The `x` parameter must be the raw data object, the `search` parameter must be a character vector representing the variable name(s) to be renamed, and the `replace` parameter must be a character vector representing the new names for the variables specificed in the `search` parameter. Below we show how to rename variables using a fake dataset called `raw_data`.

    # Create fake data
    raw_data <- data.frame(
      age_years = sample(8:12, 100, replace = TRUE),
      genders = sample(c("girl", "boy"), 100, replace = TRUE, prob = c(0.51, 0.49)),
      step_counts1 = sample(1000:30000, 100, replace = TRUE),
      step_counts2 = sample(1000:30000, 100, replace = TRUE),
      step_counts3 = sample(1000:30000, 100, replace = TRUE),
      step_counts4 = sample(1000:30000, 100, replace = TRUE),
      step_counts5 = sample(1000:30000, 100, replace = TRUE),
      step_counts6 = sample(1000:30000, 100, replace = TRUE),
      step_counts7 = sample(1000:30000, 100, replace = TRUE)
    )

    # Examine the structure of this data
    str(raw_data)
    #> 'data.frame':    100 obs. of  9 variables:
    #>  $ age_years   : int  10 11 10 12 11 10 9 11 9 10 ...
    #>  $ genders     : chr  "boy" "girl" "girl" "girl" ...
    #>  $ step_counts1: int  11270 28657 15265 20530 4297 27950 29183 7587 26347 23758 ...
    #>  $ step_counts2: int  21344 1555 26582 28398 19696 25712 22505 14109 11511 28814 ...
    #>  $ step_counts3: int  19846 27190 28220 11657 13947 23189 6460 4110 16202 27480 ...
    #>  $ step_counts4: int  28702 18124 6937 26191 22156 19665 5524 7143 23614 21583 ...
    #>  $ step_counts5: int  23579 8113 4736 24895 8246 21498 18466 6378 28749 11644 ...
    #>  $ step_counts6: int  22961 3050 10305 15144 5867 21254 5790 28853 26437 29569 ...
    #>  $ step_counts7: int  9582 21427 15006 11178 3369 9065 17739 10447 13078 18389 ...

    # Rename the variables
    raw_data <- rename_variable(
      x = raw_data,
      search = c(
        "age_years",
        "genders",
        "step_counts1",
        "step_counts2",
        "step_counts3",
        "step_counts4",
        "step_counts5",
        "step_counts6",
        "step_counts7"
      ),
      replace = c(
        "age",
        "gender",
        "steps1",
        "steps2",
        "steps3",
        "steps4",
        "steps5",
        "steps6",
        "steps7"
        )
    )

    # Examine the structure of this data
    str(raw_data)
    #> 'data.frame':    100 obs. of  9 variables:
    #>  $ age   : int  10 11 10 12 11 10 9 11 9 10 ...
    #>  $ gender: chr  "boy" "girl" "girl" "girl" ...
    #>  $ steps1: int  11270 28657 15265 20530 4297 27950 29183 7587 26347 23758 ...
    #>  $ steps2: int  21344 1555 26582 28398 19696 25712 22505 14109 11511 28814 ...
    #>  $ steps3: int  19846 27190 28220 11657 13947 23189 6460 4110 16202 27480 ...
    #>  $ steps4: int  28702 18124 6937 26191 22156 19665 5524 7143 23614 21583 ...
    #>  $ steps5: int  23579 8113 4736 24895 8246 21498 18466 6378 28749 11644 ...
    #>  $ steps6: int  22961 3050 10305 15144 5867 21254 5790 28853 26437 29569 ...
    #>  $ steps7: int  9582 21427 15006 11178 3369 9065 17739 10447 13078 18389 ...

### Eliminating noisy errors with validation

One of the coding philosophies behind the `capl` package is to create a “quiet” user experience by suppressing “noisy” error and warning messages via validation. That is, the `capl` package returns missing or invalid values as NA values instead of throwing “noisy” errors that halt code execution. If any variable is missing, for example, the `get_capl()` function will continue to execute without throwing error or warning messages. The `get_missing_capl_variables()` function will create required variables that are missing and populate these variables with NA values. In order to implement the validation philosophy, every `capl` function enlists helper functions to validate the data. If a given value is not of the correct class or out of range, an NA will be returned.

#### Validation functions in the `capl` package

There are eight functions included in the `capl` package (displayed in alphabetical order) to help provide a “quiet” user experience:

- `validate_age()`
- `validate_character()`
- `validate_domain_score()`
- `validate_gender()`
- `validate_integer()`
- `validate_number()`
- `validate_scale()`
- `validate_steps()`

Users can learn more about these functions by accessing the documentation within the R environment.

    ?validate_age
    ?validate_character
    ?validate_domain_score
    ?validate_gender
    ?validate_integer
    ?validate_number
    ?validate_scale
    ?validate_steps

#### Validation of age

The CAPL-2 is currently validated with 8- to 12-year-old children. However, when a function requires the `age` variable to execute a computation (e.g., `get_capl_interpretation()`), the `age` variable is validated via the `validate_age()` function.

    validated_age <- validate_age(c(7, 8, 9, 10, 11, 12, 13, "", NA, "12", 8.5))

Notice the NA values in the results.

    validated_age
    #>  [1] NA  8  9 10 11 12 NA NA NA 12  8

The first element is NA because the original value is 7. The next five elements are identical to their original values because they are integers between 8 and 12. The seventh element is NA because the original value is 13. The next two elements are NA because the original values ("" and NA) are obviously invalid. The last element is 8, but notice that the original value is a decimal. Because 8.5 is between 8 and 12, it is considered valid but the floor of the value is returned since CAPL performs age-specific computations based on integer age.

#### Validation of gender

The CAPL-2 is currently validated for children who identify as boys or girls. When a function requires the `gender` variable to execute a computation (e.g., `get_capl_interpretation()`), the `gender` variable is validated via the `validate_gender()` function.

    validated_gender <- validate_gender(c("Girl", "GIRL", "g", "G", "Female", "f", "F", "", NA, 1))

    validated_gender
    #>  [1] "girl" "girl" "girl" "girl" "girl" "girl" "girl" NA     NA     "girl"

Notice the results again. This function accepts a number of case-insensitive options (e.g., “Girl”, “G”, “Female”, “F”, 1) for the female gender and returns a standardized “girl” value. The only two elements that are returned as NA have original values that are obviously invalid ("" and NA). The `validate_gender()` function behaves in a similar fashion for the male gender; it also accepts a number of case-insensitive options and returns a standardized “boy” value.

    validated_gender <- validate_gender(c("Boy", "BOY", "b", "B", "Male", "m", "M", "", NA, 0))

    validated_gender
    #>  [1] "boy" "boy" "boy" "boy" "boy" "boy" "boy" NA    NA    "boy"

## Computing CAPL-2 scores and interpretations

The CAPL-2 scoring system is nicely summarized in figure 2 of the CAPL-2 manual on page 7:

The main function in the `capl` package is the `get_capl()` function. This function takes two parameters, `raw_data` and `sort`. It computes the CAPL-2 scores in figure 2 above and their associated age- and gender-specific interpretations, row by row, by calling the other functions in the `capl` package. The `raw_data` parameter must be structured as a data frame and contain the raw data. The `sort` parameter is set to “asis” by default. This means the 40 new variables will be added to the data frame as they are computed. If `sort` is set to “abc”, all variables will be sorted alphabetically whereas if `sort` is set to “zyx”, all variables will be sorted in reverse alphabetical order. Once the raw data has been imported, computing the CAPL-2 scores and interpretations is as simple as executing one line of code:

    capl_results <- get_capl(raw_data = capl_demo_data, sort = "asis")

The addition of the 40 variables related to/including the CAPL-2 scores and interpretations can be confirmed by calling the base R `str()` function. As illustrated on the first line of the output, there are now 500 rows of participant data on 100 variables.

    str(capl_results, list.len = nrow(capl_results))
    #> 'data.frame':    500 obs. of  100 variables:
    #>  $ age                       : int  8 9 9 8 12 10 12 10 12 9 ...
    #>  $ gender                    : chr  "Male" "Female" "Male" "f" ...
    #>  $ pacer_lap_distance        : num  15 20 20 15 20 15 15 15 15 NA ...
    #>  $ pacer_laps                : int  23 31 169 50 63 15 32 143 43 182 ...
    #>  $ plank_time                : int  274 282 9 228 252 110 21 185 6 41 ...
    #>  $ camsa_skill_score1        : int  14 5 6 13 2 9 4 11 5 11 ...
    #>  $ camsa_time1               : int  34 27 13 35 21 NA NA 16 20 14 ...
    #>  $ camsa_skill_score2        : int  14 5 13 11 14 14 0 4 0 4 ...
    #>  $ camsa_time2               : int  35 23 14 35 23 23 33 30 29 18 ...
    #>  $ steps1                    : int  30627 27788 8457 8769 14169 9610 29459 17112 30008 18270 ...
    #>  $ time_on1                  : chr  "5:13am" "6:13" "6:07" "6:13" ...
    #>  $ time_off1                 : chr  "22:00" NA "21:00" "22:00" ...
    #>  $ non_wear_time1            : int  25 31 33 25 83 67 20 10 49 64 ...
    #>  $ steps2                    : int  14905 24750 30111 21077 15786 23828 24735 2621 20690 19652 ...
    #>  $ time_on2                  : chr  "06:00" "5:13am" "6:13" "6:13" ...
    #>  $ time_off2                 : chr  "21:00" "23:00" "11:13pm" "23:00" ...
    #>  $ non_wear_time2            : int  20 82 4 55 1 53 65 47 82 79 ...
    #>  $ steps3                    : int  21972 15827 14130 13132 18022 12817 14065 26352 27090 10226 ...
    #>  $ time_on3                  : chr  "07:00" "05:00" "07:48am" NA ...
    #>  $ time_off3                 : chr  "11:57pm" NA "08:30pm" NA ...
    #>  $ non_wear_time3            : int  6 79 23 65 34 15 72 76 60 40 ...
    #>  $ steps4                    : int  28084 27369 14315 9963 6993 10092 10774 3208 2878 9055 ...
    #>  $ time_on4                  : chr  "05:00" "6:13" "6:07" NA ...
    #>  $ time_off4                 : chr  "08:30pm" "10:57 pm" "22:00" "11:13pm" ...
    #>  $ non_wear_time4            : int  32 38 74 20 75 22 84 59 42 22 ...
    #>  $ steps5                    : int  14858 21112 16880 11707 20917 30200 20220 17995 18712 25336 ...
    #>  $ time_on5                  : chr  "6:07" "6:13" "06:00" "05:00" ...
    #>  $ time_off5                 : chr  "11:57pm" "23:00" "8:17pm" "8:17pm" ...
    #>  $ non_wear_time5            : int  61 64 73 23 82 42 66 38 55 18 ...
    #>  $ steps6                    : int  17705 5564 16459 12235 27766 26099 15763 7202 2746 3895 ...
    #>  $ time_on6                  : chr  "06:00" "06:00" NA "6:07" ...
    #>  $ time_off6                 : chr  "21:00" NA "10:57 pm" "08:30pm" ...
    #>  $ non_wear_time6            : int  33 24 89 8 27 56 66 21 14 7 ...
    #>  $ steps7                    : int  11067 13540 12106 18795 15039 9082 3733 4029 20791 28499 ...
    #>  $ time_on7                  : chr  "6:07" "6:07" "8:00am" "06:00" ...
    #>  $ time_off7                 : chr  "08:30pm" "11:13pm" "8:17pm" "10:57 pm" ...
    #>  $ non_wear_time7            : int  8 72 4 38 9 32 49 36 34 43 ...
    #>  $ self_report_pa            : int  NA 2 2 4 3 5 NA 7 6 7 ...
    #>  $ csappa1                   : int  1 2 4 2 2 2 3 2 2 3 ...
    #>  $ csappa2                   : int  3 2 1 1 1 1 4 1 4 3 ...
    #>  $ csappa3                   : int  2 3 2 1 NA 1 3 3 4 4 ...
    #>  $ csappa4                   : int  4 1 1 3 4 4 4 4 4 1 ...
    #>  $ csappa5                   : int  4 2 3 2 1 2 2 2 4 1 ...
    #>  $ csappa6                   : int  3 4 1 4 2 2 2 3 4 4 ...
    #>  $ why_active1               : int  4 3 5 3 1 5 4 1 1 2 ...
    #>  $ why_active2               : int  5 3 4 2 5 3 5 NA 5 NA ...
    #>  $ why_active3               : int  3 3 1 4 2 3 4 4 5 3 ...
    #>  $ feelings_about_pa1        : int  4 3 2 2 1 1 3 4 4 2 ...
    #>  $ feelings_about_pa2        : int  5 2 2 3 4 2 4 4 2 5 ...
    #>  $ feelings_about_pa3        : int  2 5 2 5 3 2 2 1 3 5 ...
    #>  $ pa_guideline              : int  2 3 4 1 2 4 3 2 2 2 ...
    #>  $ crf_means                 : int  1 4 4 2 2 1 2 1 4 1 ...
    #>  $ ms_means                  : int  3 2 1 2 3 1 1 2 4 2 ...
    #>  $ sports_skill              : int  2 4 4 1 3 1 3 1 4 3 ...
    #>  $ pa_is                     : int  10 1 1 1 1 1 2 1 3 1 ...
    #>  $ pa_is_also                : int  5 1 4 4 1 7 2 7 2 8 ...
    #>  $ improve                   : int  3 3 9 3 9 9 3 3 3 6 ...
    #>  $ increase                  : int  2 8 3 8 8 1 3 3 8 8 ...
    #>  $ when_cooling_down         : int  4 2 4 2 2 2 2 5 2 2 ...
    #>  $ heart_rate                : int  5 6 4 4 4 9 4 8 7 4 ...
    #>  $ pacer_laps_20m            : num  18 31 169 38 63 12 25 110 33 NA ...
    #>  $ pacer_score               : num  3 6 10 7 10 2 5 10 6 NA ...
    #>  $ pacer_interpretation      : chr  "progressing" "excelling" "excelling" "excelling" ...
    #>  $ plank_score               : num  10 10 0 10 10 9 1 10 0 3 ...
    #>  $ plank_interpretation      : chr  "excelling" "excelling" "beginning" "excelling" ...
    #>  $ camsa_time_score1         : num  1 3 14 1 6 NA NA 11 7 13 ...
    #>  $ camsa_time_score2         : num  1 5 13 1 5 5 1 1 2 9 ...
    #>  $ camsa_skill_time_score1   : num  15 8 20 14 8 NA NA 22 12 24 ...
    #>  $ camsa_skill_time_score2   : num  15 10 26 12 19 19 1 5 2 13 ...
    #>  $ camsa_score               : num  5.36 3.57 9.29 5 6.79 ...
    #>  $ camsa_interpretation      : chr  "beginning" "beginning" "excelling" "beginning" ...
    #>  $ pc_score                  : num  19.5 24 15 22 30 16.5 9 30 9 NA ...
    #>  $ pc_interpretation         : chr  "achieving" "excelling" "progressing" "excelling" ...
    #>  $ pc_status                 : chr  "complete" "complete" "complete" "complete" ...
    #>  $ valid_days                : int  6 4 5 5 7 6 7 7 6 6 ...
    #>  $ step_average              : num  18098 21693 13178 14517 16956 ...
    #>  $ step_score                : num  25 25 19 21 23 22 23 15 22 23 ...
    #>  $ step_interpretation       : chr  "excelling" "excelling" "achieving" "achieving" ...
    #>  $ self_report_pa_score      : num  NA 1 1 3 2 4 NA 5 5 5 ...
    #>  $ db_score                  : num  NA 26 20 24 25 26 NA 20 27 28 ...
    #>  $ db_interpretation         : chr  NA "achieving" "progressing" "achieving" ...
    #>  $ db_status                 : chr  "incomplete" "complete" "complete" "complete" ...
    #>  $ predilection_score        : num  3.6 4.9 5.5 3 NA 3 6.2 4.9 4.8 4.9 ...
    #>  $ adequacy_score            : num  2.4 5.5 7.5 4.3 5.5 5.5 4.2 4.3 3.6 4.3 ...
    #>  $ intrinsic_motivation_score: num  6 4.5 5 4.5 4 5.5 6.5 NA 5.5 NA ...
    #>  $ pa_competence_score       : num  5.5 5 3 5 4 2.5 4.5 4.5 4.5 6 ...
    #>  $ mc_score                  : num  17.5 19.9 21 16.8 18 ...
    #>  $ mc_interpretation         : chr  "progressing" "progressing" "progressing" "progressing" ...
    #>  $ mc_status                 : chr  "complete" "complete" "complete" "complete" ...
    #>  $ pa_guideline_score        : num  0 1 0 0 0 0 1 0 0 0 ...
    #>  $ crf_means_score           : num  0 0 0 1 1 0 1 0 0 0 ...
    #>  $ ms_means_score            : num  0 0 1 0 0 1 1 0 0 0 ...
    #>  $ sports_skill_score        : num  0 1 1 0 0 0 0 0 1 0 ...
    #>  $ fill_in_the_blanks_score  : num  1 5 2 5 5 3 3 3 3 4 ...
    #>  $ ku_score                  : num  1 7 4 6 6 4 6 3 4 4 ...
    #>  $ ku_interpretation         : chr  "beginning" "achieving" "beginning" "progressing" ...
    #>  $ ku_status                 : chr  "complete" "complete" "complete" "complete" ...
    #>  $ capl_score                : num  54.3 76.9 60 68.8 79 ...
    #>  $ capl_interpretation       : chr  "progressing" "excelling" "progressing" "achieving" ...
    #>  $ capl_status               : chr  "missing protocol" "complete" "complete" "complete" ...

### Forty variables computed by get_capl()

The 40 new variables related to/including the CAPL-2 scores and interpretations that are output from the `get_capl()` function include:

- `pacer_laps_20m`
- `pacer_score`
- `pacer_interpretation`
- `plank_score`
- `plank_interpretation`
- `camsa_time_score1`
- `camsa_time_score2`
- `camsa_skill_time_score1`
- `camsa_skill_time_score2`
- `camsa_score`
- `camsa_interpretation`
- `pc_score`
- `pc_interpretation`
- `pc_status`
- `step_average`
- `valid_days`
- `step_score`
- `step_interpretation`
- `self_report_pa_score`
- `db_score`
- `db_interpretation`
- `db_status`
- `predilection_score`
- `adequacy_score`
- `intrinsic_motivation_score`
- `pa_competence_score`
- `mc_score`
- `mc_interpretation`
- `mc_status`
- `pa_guideline_score`
- `crf_means_score`
- `ms_means_score`
- `sports_skill_score`
- `fill_in_the_blanks_score`
- `ku_score`
- `ku_interpretation`
- `ku_status`
- `capl_score`
- `capl_interpretation`
- `capl_status`

## Computing CAPL-2 scores and interpretations manually

Some users may want to validate and compute individual variables and scores. The following sections introduce the helper functions in the order they appear when called in the `get_capl()` function.

### Physical competence functions

As illustrated in the CAPL-2 manual on page 43, the physical competence score is computed by summing the PACER (Progressive Aerobic Cardiovascular Endurance Run), plank, and CAMSA (Canadian Agility and Movement Skill Assessment) scores:

#### PACER 20-metre laps

The `pacer_laps_20m()` function converts PACER (Progressive Aerobic Cardiovascular Endurance Run) shuttle run laps to their equivalent in 20-metre laps. If laps are already 20-metre laps, they are returned unless outside the valid range (1-229). This variable is used to compute the PACER score.

    capl_demo_data$pacer_laps_20m <- get_pacer_20m_laps(
      lap_distance = capl_demo_data$pacer_lap_distance,
      laps_run = capl_demo_data$pacer_laps
    )

    capl_demo_data$pacer_laps_20m
    #>   [1]  18  31 169  38  63  12  25 110  33  NA 127  62  39  19  NA  84 145 166
    #>  [19] 108 125  98 147  85  49   4 118 144  85 122  85 197   5 184  19  63 112
    #>  [37]  89  46 178  35  69 122  54  79 120  85   1 187  59 178  47  55  89  98
    #>  [55]  79 119  11  70  89  88  68  82 116  38 152 195   4  69 100  99  NA  88
    #>  [73]  57  43  98 125 127   5  16 173  20  33  89  99  39  35  43 100 177  15
    #>  [91] 141 141  39  NA   8  41  43   2 101  NA  54  78  90 176  40   2 122  58
    #> [109]  98   5  51 112 101 122  12 177  38  92  31  53 102 200 138 166  62  31
    #> [127]  86  75  87  56 147 140  45  51 136  74 148 194  67 142 172 121  NA  78
    #> [145]  40  18  59 190  78  69  33  78  78  58  84 122  27 199 147  75 180  84
    #> [163]  36 129  14 133  70  65   8  43 110  64  69 120 125  28 142 115 108  14
    #> [181] 113 108  41  52  53  92 111 180 108 101 167  78  26  23  44 200 131  19
    #> [199] 122 144  16  28 105 135  92 173  79  17  NA  74  63  32  37 161 116  NA
    #> [217]  28  48  60  52  35  49  NA 117  48  60 110  45  72 109  NA  32  98  37
    #> [235]  84  29  57 108 138 117 123  92  NA 112 140 171   9 191  NA 106 142  85
    #> [253]  82  99   2 193 132 106  NA 152 188  61  36  NA 124  19  29 137 137  24
    #> [271]  18 118 196  95  48 195  22 144 138  76  57 154  60 128 154  85  61   7
    #> [289] 102 200  98 118 139  64 148  88 131  64 104  90 109 125  92 107 127 137
    #> [307] 139  68  61  43 133 102 127 146  30  89  42 122  77  50  80 105  NA  46
    #> [325] 154 122 173  10  78  41 150 140 129  30  84   3   6  74 186  NA   1  63
    #> [343] 108  98  73 102 131 126 144  95  62 115 165  49  49 187 101 151  53  52
    #> [361]  78 137   4  45 120 139   1  21  NA  76 134  16  12 125  63 140 144 102
    #> [379] 141  62 134 142  90 193  NA  95  58  NA  28  21 150 100 185 140 142  NA
    #> [397] 138  76  15  47  38 116 153  83  61  83  89  89 196  88 105  99 110  20
    #> [415] 122 110 163  61 160  71 135   6 105 189   7  70  90  40 104 107  NA 165
    #> [433]  27  78  42 167  51  57 128  44  25  NA  13  79  98  34 107 167  75  NA
    #> [451] 119  13  82 136  21 140  58 126 144  35  25  29  97 195 131   3  18  66
    #> [469]  NA  58  65  75 129  NA 196 175 112 134 145 141  65  10  NA  32  68  NA
    #> [487] 144 135 112 130 112  52  51 142  24  NA  96 125  65  45

#### PACER score

The `get_pacer_score()` function computes a PACER (Progressive Aerobic Cardiovascular Endurance Run) score that ranges from zero to 10 based on the number of PACER laps run at a 20-metre distance. This score is used to compute the physical competence domain score variable.

    capl_demo_data$pacer_score <- get_pacer_score(capl_demo_data$pacer_laps_20m)

    capl_demo_data$pacer_score
    #>   [1]  3  6 10  7 10  2  5 10  6 NA 10 10  7  3 NA 10 10 10 10 10 10 10 10  9  0
    #>  [26] 10 10 10 10 10 10  1 10  3 10 10 10  9 10  7 10 10 10 10 10 10  0 10 10 10
    #>  [51]  9 10 10 10 10 10  2 10 10 10 10 10 10  7 10 10  0 10 10 10 NA 10 10  8 10
    #>  [76] 10 10  1  3 10  4  6 10 10  7  7  8 10 10  3 10 10  7 NA  1  8  8  0 10 NA
    #> [101] 10 10 10 10  8  0 10 10 10  1 10 10 10 10  2 10  7 10  6 10 10 10 10 10 10
    #> [126]  6 10 10 10 10 10 10  9 10 10 10 10 10 10 10 10 10 NA 10  8  3 10 10 10 10
    #> [151]  6 10 10 10 10 10  5 10 10 10 10 10  7 10  2 10 10 10  1  8 10 10 10 10 10
    #> [176]  5 10 10 10  2 10 10  8 10 10 10 10 10 10 10 10 10  5  4  8 10 10  3 10 10
    #> [201]  3  5 10 10 10 10 10  3 NA 10 10  6  7 10 10 NA  5  9 10 10  7  9 NA 10  9
    #> [226] 10 10  9 10 10 NA  6 10  7 10  5 10 10 10 10 10 10 NA 10 10 10  1 10 NA 10
    #> [251] 10 10 10 10  0 10 10 10 NA 10 10 10  7 NA 10  3  5 10 10  4  3 10 10 10  9
    #> [276] 10  4 10 10 10 10 10 10 10 10 10 10  1 10 10 10 10 10 10 10 10 10 10 10 10
    #> [301] 10 10 10 10 10 10 10 10 10  8 10 10 10 10  6 10  8 10 10 10 10 10 NA  9 10
    #> [326] 10 10  2 10  8 10 10 10  6 10  0  1 10 10 NA  0 10 10 10 10 10 10 10 10 10
    #> [351] 10 10 10  9  9 10 10 10 10 10 10 10  0  9 10 10  0  4 NA 10 10  3  2 10 10
    #> [376] 10 10 10 10 10 10 10 10 10 NA 10 10 NA  5  4 10 10 10 10 10 NA 10 10  3  9
    #> [401]  7 10 10 10 10 10 10 10 10 10 10 10 10  4 10 10 10 10 10 10 10  1 10 10  1
    #> [426] 10 10  8 10 10 NA 10  5 10  8 10 10 10 10  8  5 NA  2 10 10  6 10 10 10 NA
    #> [451] 10  2 10 10  4 10 10 10 10  7  5  5 10 10 10  0  3 10 NA 10 10 10 10 NA 10
    #> [476] 10 10 10 10 10 10  2 NA  6 10 NA 10 10 10 10 10 10 10 10  4 NA 10 10 10  9

#### PACER interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$pacer_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$pacer_score,
      protocol = "pacer"
    )

    capl_demo_data$pacer_interpretation
    #>   [1] "beginning"   "beginning"   "progressing" "beginning"   "beginning"
    #>   [6] "beginning"   "beginning"   "progressing" "beginning"   NA
    #>  [11] NA            "beginning"   NA            NA            NA
    #>  [16] "progressing" "beginning"   "progressing" "beginning"   "progressing"
    #>  [21] "beginning"   "beginning"   "progressing" NA            NA
    #>  [26] NA            "beginning"   NA            "beginning"   "progressing"
    #>  [31] "progressing" "beginning"   "beginning"   NA            "beginning"
    #>  [36] NA            NA            "beginning"   "progressing" "beginning"
    #>  [41] "beginning"   "progressing" "progressing" "beginning"   "beginning"
    #>  [46] "progressing" NA            "progressing" NA            NA
    #>  [51] "progressing" "progressing" "beginning"   "beginning"   "progressing"
    #>  [56] "progressing" "beginning"   "progressing" "progressing" "beginning"
    #>  [61] "beginning"   NA            "progressing" "beginning"   "progressing"
    #>  [66] NA            NA            "progressing" NA            "progressing"
    #>  [71] NA            "progressing" "beginning"   "beginning"   NA
    #>  [76] "progressing" NA            "beginning"   "beginning"   "beginning"
    #>  [81] NA            "beginning"   "progressing" "beginning"   "beginning"
    #>  [86] NA            "beginning"   "progressing" "progressing" "beginning"
    #>  [91] "progressing" "beginning"   NA            NA            NA
    #>  [96] "beginning"   NA            NA            "progressing" NA
    #> [101] "beginning"   "beginning"   "beginning"   NA            "beginning"
    #> [106] NA            "beginning"   "progressing" "progressing" "beginning"
    #> [111] "beginning"   "progressing" "beginning"   NA            "beginning"
    #> [116] "progressing" "beginning"   "beginning"   "beginning"   "progressing"
    #> [121] NA            "beginning"   "progressing" "progressing" "beginning"
    #> [126] NA            "progressing" NA            NA            "beginning"
    #> [131] "beginning"   NA            "beginning"   "beginning"   "beginning"
    #> [136] "progressing" "progressing" "progressing" "beginning"   "beginning"
    #> [141] "beginning"   "beginning"   NA            "beginning"   "beginning"
    #> [146] "beginning"   NA            NA            "beginning"   "beginning"
    #> [151] "beginning"   "progressing" "beginning"   "beginning"   "beginning"
    #> [156] "progressing" "beginning"   "beginning"   "progressing" "progressing"
    #> [161] NA            "beginning"   "beginning"   "progressing" NA
    #> [166] "progressing" "beginning"   NA            "beginning"   "beginning"
    #> [171] "beginning"   "progressing" "progressing" "beginning"   "progressing"
    #> [176] "beginning"   "beginning"   NA            NA            "beginning"
    #> [181] "progressing" NA            "beginning"   NA            "beginning"
    #> [186] "progressing" "progressing" "beginning"   "progressing" NA
    #> [191] "progressing" "beginning"   "beginning"   "beginning"   NA
    #> [196] "progressing" "beginning"   "beginning"   "progressing" NA
    #> [201] "beginning"   "beginning"   "progressing" "progressing" "progressing"
    #> [206] "progressing" "progressing" "beginning"   NA            NA
    #> [211] NA            "beginning"   "beginning"   "beginning"   "progressing"
    #> [216] NA            NA            "progressing" "progressing" "progressing"
    #> [221] "beginning"   "beginning"   NA            NA            "beginning"
    #> [226] "progressing" "progressing" NA            "progressing" NA
    #> [231] NA            "beginning"   "progressing" "beginning"   "progressing"
    #> [236] "beginning"   "beginning"   "beginning"   "beginning"   "progressing"
    #> [241] "progressing" "beginning"   NA            NA            NA
    #> [246] "progressing" "beginning"   NA            NA            "beginning"
    #> [251] NA            "progressing" NA            "progressing" NA
    #> [256] "beginning"   "beginning"   "beginning"   NA            NA
    #> [261] "progressing" "progressing" "beginning"   NA            "progressing"
    #> [266] "beginning"   "beginning"   "beginning"   "progressing" "beginning"
    #> [271] "beginning"   "beginning"   NA            "beginning"   "beginning"
    #> [276] "progressing" "beginning"   "progressing" "beginning"   "beginning"
    #> [281] "beginning"   NA            "beginning"   "progressing" "progressing"
    #> [286] "progressing" "progressing" "beginning"   "beginning"   "beginning"
    #> [291] "beginning"   "beginning"   "beginning"   "beginning"   NA
    #> [296] "progressing" "progressing" "progressing" "progressing" "beginning"
    #> [301] "progressing" "beginning"   "beginning"   "beginning"   "beginning"
    #> [306] "progressing" "progressing" NA            NA            "beginning"
    #> [311] "progressing" "beginning"   "beginning"   "beginning"   "beginning"
    #> [316] "beginning"   "beginning"   "progressing" "beginning"   NA
    #> [321] "progressing" "progressing" NA            "beginning"   "beginning"
    #> [326] NA            "progressing" "beginning"   "beginning"   "beginning"
    #> [331] "beginning"   "progressing" "beginning"   "beginning"   "progressing"
    #> [336] NA            "beginning"   "progressing" "beginning"   NA
    #> [341] NA            NA            "progressing" "progressing" "beginning"
    #> [346] "progressing" "progressing" "beginning"   "progressing" "progressing"
    #> [351] NA            NA            "beginning"   "beginning"   "beginning"
    #> [356] "beginning"   NA            "progressing" "progressing" "progressing"
    #> [361] NA            "progressing" NA            "beginning"   "progressing"
    #> [366] "beginning"   NA            "beginning"   NA            "progressing"
    #> [371] "progressing" "beginning"   "beginning"   NA            "progressing"
    #> [376] "beginning"   "beginning"   NA            NA            "beginning"
    #> [381] "beginning"   "beginning"   "progressing" "progressing" NA
    #> [386] "beginning"   "progressing" NA            "beginning"   "beginning"
    #> [391] "progressing" "beginning"   NA            "progressing" "beginning"
    #> [396] NA            "progressing" NA            "beginning"   "beginning"
    #> [401] NA            "progressing" "progressing" "progressing" "progressing"
    #> [406] "progressing" NA            "progressing" "progressing" "beginning"
    #> [411] NA            "progressing" "beginning"   "beginning"   "beginning"
    #> [416] "progressing" "progressing" "progressing" "progressing" NA
    #> [421] "progressing" "beginning"   "progressing" "progressing" "beginning"
    #> [426] "progressing" "beginning"   "beginning"   "progressing" "beginning"
    #> [431] NA            "progressing" "beginning"   NA            "beginning"
    #> [436] "progressing" "progressing" "progressing" "progressing" "beginning"
    #> [441] "beginning"   NA            "beginning"   "beginning"   "beginning"
    #> [446] "beginning"   "beginning"   "progressing" "beginning"   NA
    #> [451] "beginning"   "beginning"   NA            "progressing" "beginning"
    #> [456] "beginning"   "progressing" "beginning"   "beginning"   "beginning"
    #> [461] NA            "beginning"   "beginning"   "progressing" NA
    #> [466] NA            "beginning"   NA            NA            NA
    #> [471] "progressing" "progressing" NA            NA            "progressing"
    #> [476] "beginning"   NA            "beginning"   "progressing" "beginning"
    #> [481] NA            "beginning"   NA            NA            "beginning"
    #> [486] NA            "beginning"   NA            "beginning"   "beginning"
    #> [491] "beginning"   "progressing" "progressing" "beginning"   "beginning"
    #> [496] NA            NA            NA            "beginning"   "beginning"

#### Plank score

The `get_plank_score()` function computes a plank score that ranges from zero to 10 based on the duration of time (in seconds) for which a plank is held. This score is used to compute the physical competence domain score.

    capl_demo_data$plank_score <- get_plank_score(capl_demo_data$plank_time)

    capl_demo_data$plank_score
    #>   [1] 10 10  0 10 10  9  1 10  0  3 10 10 10 10 10 10 10 10  0 10 10  5  3 10  9
    #>  [26] 10 10  0 10  5  0  0  5 10  5 10  4  7 10  3  6 10  0 10  8  6 10 10  0 10
    #>  [51]  5  9 10 10 10 10 10 10 10 10 10  8  0 10  4 10  2  9  0  6 10 10  7 10  4
    #>  [76] 10 10 10  6  0 10 10 10 10  9 10 10 10 10  5  0 10 10 10  1  8 10 10  8  2
    #> [101]  4 10  0 10  2 10  9 10  3 10 10  5 10  8  4 10 10 10 10  0 10 10  0 10 10
    #> [126] 10 10 10 10 10  5 10  3 10  0 10  7  0 10  7  0 10 10 10  6 10 10 10  0  1
    #> [151]  5 10 10  5  2 10  4 10 10 10 10  1 10  0  8 10 10  0  7  7 10 10  1 10 10
    #> [176] 10 10 10 10 10  1  0  9 10 10 10 10 10 10 10  6  3  3 10 10  1 10 10 10  8
    #> [201]  0  0 10  4 10  3 10 10  3  0 10  3 10 10 10  7 10  0 10 10 10  1 10 10  0
    #> [226] 10 10 10  2  4 10  0  4  0 10 10  0  6 10 10 10  0 10 10  8 10 10 10  0 10
    #> [251] 10 10  2 10 10 10 10  8 10 10 10  8 10 10 10 10  1 10 10 10 10 10 10  9  4
    #> [276]  4 10 10 10 10 10  5  8 10 10 10 10 10  6 10  8 10  0 10  7  2 10  0 10 10
    #> [301]  0  5 10  6 10 10 10 10 10 10  6 10 10  5  2  7 10 10 10 10 10 10 10 10 10
    #> [326] 10  5  0  0 10 10 10  0  7 10 10 10 10  7 10 10 10 10 10 10 10 10  0  0 10
    #> [351] 10 10 10 10 10  2 10 10 10  7  9 10 10 10  9  6 10  0 10 10 10 10  9 10 10
    #> [376]  3 10 10 10 10  7  6 10 10  8 10 10 10  4  5 10 10 10 10  9 10  2 10 10  5
    #> [401] 10  5  9 10 10  0 10 10 10 10 10 10  6 10 10  0 10  4 10  8  2  4  3 10  7
    #> [426] 10 10 10 10  6 10 10  8 10 10 10 10 10 10  3  3 10 10 10  4 10 10  0 10 10
    #> [451] 10 10  9  8 10 10  3 10  6  2  0 10 10  4  2  2 10  9 10  0  7 10  6  7  3
    #> [476]  0  2 10 10  8 10 10 10 10  8 10  2  3 10  3  6  4 10 10 10 10 10  2 10  0

#### Plank interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$plank_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$plank_time,
      protocol = "plank"
    )

    capl_demo_data$plank_interpretation
    #>   [1] "excelling"   "excelling"   "beginning"   "excelling"   "excelling"
    #>   [6] "excelling"   "beginning"   "excelling"   "beginning"   "progressing"
    #>  [11] NA            "excelling"   NA            NA            "excelling"
    #>  [16] "excelling"   "excelling"   "excelling"   "beginning"   "excelling"
    #>  [21] "excelling"   "achieving"   "progressing" NA            NA
    #>  [26] NA            "excelling"   NA            "excelling"   "progressing"
    #>  [31] "beginning"   "beginning"   "progressing" NA            "progressing"
    #>  [36] NA            NA            "achieving"   "excelling"   "progressing"
    #>  [41] "progressing" "excelling"   "beginning"   "excelling"   "achieving"
    #>  [46] "progressing" "excelling"   "excelling"   NA            NA
    #>  [51] "achieving"   "excelling"   "excelling"   "excelling"   "excelling"
    #>  [56] "excelling"   "excelling"   "excelling"   "excelling"   "excelling"
    #>  [61] "excelling"   NA            "beginning"   "excelling"   "progressing"
    #>  [66] NA            "progressing" "excelling"   NA            "achieving"
    #>  [71] "excelling"   "excelling"   "achieving"   "excelling"   NA
    #>  [76] "excelling"   NA            "excelling"   "progressing" "beginning"
    #>  [81] NA            "excelling"   "excelling"   "excelling"   "achieving"
    #>  [86] NA            "excelling"   "excelling"   "excelling"   "progressing"
    #>  [91] "beginning"   "excelling"   NA            NA            NA
    #>  [96] "achieving"   NA            "excelling"   "achieving"   "progressing"
    #> [101] "progressing" "excelling"   "beginning"   NA            "progressing"
    #> [106] "excelling"   "achieving"   "excelling"   "progressing" "excelling"
    #> [111] "excelling"   "achieving"   "excelling"   NA            "progressing"
    #> [116] "excelling"   "excelling"   "excelling"   "excelling"   "beginning"
    #> [121] NA            "excelling"   "beginning"   "excelling"   "excelling"
    #> [126] NA            "excelling"   NA            NA            "excelling"
    #> [131] "progressing" NA            "progressing" "excelling"   "beginning"
    #> [136] "excelling"   "achieving"   "beginning"   "excelling"   "achieving"
    #> [141] "beginning"   "excelling"   "excelling"   "excelling"   "progressing"
    #> [146] "excelling"   NA            NA            "beginning"   "progressing"
    #> [151] "achieving"   "excelling"   "excelling"   "progressing" "progressing"
    #> [156] "excelling"   "progressing" "excelling"   "excelling"   "excelling"
    #> [161] NA            "progressing" "excelling"   "beginning"   NA
    #> [166] "excelling"   "excelling"   NA            "achieving"   "achieving"
    #> [171] "excelling"   "excelling"   "progressing" "excelling"   "excelling"
    #> [176] "excelling"   "excelling"   NA            NA            "excelling"
    #> [181] "beginning"   NA            "achieving"   NA            "excelling"
    #> [186] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [191] "achieving"   "progressing" "progressing" "excelling"   NA
    #> [196] "beginning"   "excelling"   "excelling"   "excelling"   NA
    #> [201] "beginning"   "beginning"   "excelling"   "progressing" "excelling"
    #> [206] "progressing" "excelling"   "excelling"   "progressing" NA
    #> [211] NA            "progressing" "excelling"   "excelling"   "excelling"
    #> [216] "achieving"   NA            "beginning"   "excelling"   "excelling"
    #> [221] "excelling"   "progressing" NA            NA            "beginning"
    #> [226] "excelling"   "excelling"   NA            "progressing" NA
    #> [231] "excelling"   "beginning"   "progressing" "beginning"   "excelling"
    #> [236] "excelling"   "beginning"   "achieving"   "excelling"   "excelling"
    #> [241] "excelling"   "beginning"   NA            NA            NA
    #> [246] "excelling"   "excelling"   NA            NA            "excelling"
    #> [251] NA            "excelling"   NA            "excelling"   "excelling"
    #> [256] "excelling"   "excelling"   "achieving"   "excelling"   NA
    #> [261] "excelling"   "achieving"   "excelling"   "excelling"   "excelling"
    #> [266] "excelling"   "progressing" "excelling"   "excelling"   "excelling"
    #> [271] "excelling"   "excelling"   NA            "excelling"   "progressing"
    #> [276] "progressing" "excelling"   "excelling"   "excelling"   "excelling"
    #> [281] "excelling"   NA            "achieving"   "excelling"   "excelling"
    #> [286] "excelling"   "excelling"   "excelling"   "achieving"   "excelling"
    #> [291] "achieving"   "excelling"   "beginning"   "excelling"   NA
    #> [296] "progressing" "excelling"   "beginning"   "excelling"   "excelling"
    #> [301] "beginning"   "progressing" "excelling"   "progressing" "excelling"
    #> [306] "excelling"   "excelling"   NA            NA            "excelling"
    #> [311] "achieving"   "excelling"   "excelling"   "progressing" "progressing"
    #> [316] "achieving"   "excelling"   "excelling"   "excelling"   NA
    #> [321] "excelling"   "excelling"   "excelling"   "excelling"   "excelling"
    #> [326] NA            "progressing" "beginning"   "beginning"   "excelling"
    #> [331] "excelling"   "excelling"   "beginning"   "achieving"   "excelling"
    #> [336] "excelling"   "excelling"   "excelling"   "achieving"   "excelling"
    #> [341] NA            NA            "excelling"   "excelling"   "excelling"
    #> [346] "excelling"   "excelling"   "beginning"   "progressing" "excelling"
    #> [351] NA            NA            "excelling"   "excelling"   "excelling"
    #> [356] "progressing" NA            "excelling"   "excelling"   "achieving"
    #> [361] NA            "excelling"   NA            "excelling"   "excelling"
    #> [366] "achieving"   "excelling"   "progressing" "excelling"   "excelling"
    #> [371] "excelling"   "excelling"   "excelling"   NA            "excelling"
    #> [376] "progressing" "excelling"   NA            NA            "excelling"
    #> [381] "achieving"   "progressing" "excelling"   "excelling"   "excelling"
    #> [386] "excelling"   "excelling"   NA            "progressing" "achieving"
    #> [391] "excelling"   "excelling"   NA            "excelling"   "achieving"
    #> [396] "excelling"   "progressing" NA            "excelling"   "progressing"
    #> [401] NA            "progressing" "excelling"   "excelling"   "excelling"
    #> [406] "beginning"   NA            "excelling"   "excelling"   "excelling"
    #> [411] NA            "excelling"   "progressing" "excelling"   "excelling"
    #> [416] "beginning"   "excelling"   "progressing" "excelling"   NA
    #> [421] "progressing" "progressing" "progressing" "excelling"   "achieving"
    #> [426] "excelling"   "excelling"   "excelling"   "excelling"   "achieving"
    #> [431] "excelling"   "excelling"   "achieving"   NA            "excelling"
    #> [436] "excelling"   "excelling"   "excelling"   "excelling"   "progressing"
    #> [441] "progressing" "excelling"   "excelling"   "excelling"   "progressing"
    #> [446] "excelling"   "excelling"   "beginning"   "excelling"   NA
    #> [451] "excelling"   "excelling"   NA            "excelling"   "excelling"
    #> [456] "excelling"   "progressing" "excelling"   "achieving"   "progressing"
    #> [461] NA            "excelling"   "excelling"   "progressing" NA
    #> [466] "progressing" "excelling"   NA            NA            NA
    #> [471] "achieving"   "excelling"   NA            "achieving"   "progressing"
    #> [476] "beginning"   NA            "excelling"   "excelling"   "achieving"
    #> [481] NA            "excelling"   "excelling"   NA            "achieving"
    #> [486] NA            "progressing" NA            "excelling"   "progressing"
    #> [491] "progressing" "progressing" "excelling"   "excelling"   "excelling"
    #> [496] "excelling"   NA            NA            "excelling"   "beginning"

#### CAMSA time score

The `get_camsa_time()` function computes the CAMSA (Canadian Agility and Movement Skill Assessment) time score that ranges from one to 14 based on the time taken (in seconds) to complete a trial.

    # Trial 1
    capl_demo_data$camsa_time_score1 <- get_camsa_time_score(capl_demo_data$camsa_time1)

    # Trial 2
    capl_demo_data$camsa_time_score2 <- get_camsa_time_score(capl_demo_data$camsa_time2)

    # Time scores for trial 1
    capl_demo_data$camsa_time_score1
    #>   [1]  1  3 14  1  6 NA NA 11  7 13  1 14 13 14  9 14  5 14  1  4  6  2 10 14 NA
    #>  [26] 12  6 13 14  1  8  3  1  1  1  4  1 12  2 14 14  1  5  5  1  3  9  3  1 10
    #>  [51]  7  1  8  1  2  4 11  2  6 13  6  3 14  6  4  1  1 NA  5 14  2 14  7 12 12
    #>  [76]  8  7  1 NA 14 10 NA  6  1  5  7  1  1  4  1  1  1 NA  8  4 14  1 10  4 13
    #> [101] NA  5 13 11  5  9  3  7 10  2  1 14 13 13  1 NA 14  2 13  1 11  4  1  8  1
    #> [126] NA 14 14 NA 10  5 NA  4 12  1 NA 11 11 NA NA  8  8  1  3  1 14 14  1 10  5
    #> [151]  1  1 11  6  3  5 14  2  4  1  5  6  7  1  1  8 12  2 12  1 14  6 14 12 14
    #> [176] 13  1 14  8  5 10  5  7  2 11  2 14  4 11  5 11 14 14 14  1 14  3 NA  9  8
    #> [201]  5  3  3  7  1 11  3 10 12  3 14 13  6 12  1 14  6  8  7  6 14  5  3 10  8
    #> [226]  3 13  5  4  1 14  5  3 13  1 14 14  1 14  7  6 NA  6  2  5  1  1  4  1 14
    #> [251] 14 NA  1  5  9 NA 14 14 14  1 10 14 10  9  3  3  1 10 NA 14  3 11  1  5  9
    #> [276]  5  5  5  2  4  4 14 12 14 14 11  4  2  5  1 13 14  1  7 11  4  1  9 12 NA
    #> [301] 14  2  1  1  6  1  1  2  1  1  3  7 11  8  6  4  1  1 14  1  3  2  7 14 14
    #> [326] 10  8 11  8  1  5  9 10 14  8  2  3  1 14 13 13  7  1 14  9  1 NA  1 11 13
    #> [351]  3  1  1  4 10 13  4  9  8 14  1  4 10 14 12  1  1 14 10 14  2  1  1 11  7
    #> [376]  1 14  1 10 10 13  2  3  2 14  8  2 10 13  1  7  2  1  3 14 14 14 14 10 14
    #> [401]  7  1 13 13  9 14  1 10  2  6 14  3  1  1  3  8  1 14  1  3  4 NA  8  1 14
    #> [426]  2  4  8  1 13  1  1 11  3  5  7 10  4  2  8  5  1  5  4  1 14 14  1 12  2
    #> [451]  5 10  8  1  3 14  7 14 14 12  6 NA  1 10 NA 13  6  1  1 13 12  5 14  1  1
    #> [476]  4 14  2  9  3  1  3  1  7  2  2  1  4  7 10  1  4 11 NA 13 14 14 13  6  1

    # Time scores for trial 2
    capl_demo_data$camsa_time_score2
    #>   [1]  1  5 13  1  5  5  1  1  2  9  3  8  3 14  9 14 NA  1  4  1 10  5 14  1  1
    #>  [26]  3  2 10  2  1  3 11 14 12 14 12 12  3 14 10  1 NA  1  1 14  1  6 11 13  5
    #>  [51]  1 14 14 14  3  1  8 14 14  5  1  1 14  1 NA 14 11  1 10  3  7 14  8  4  1
    #>  [76]  1  3  5  1  1 NA  8  1  5 NA  2  1 NA 10  2  1  6 14  7  3 12  8 14 14  6
    #> [101] 14  3  4 13  1  9  5  5  9  1 14 14 11  1 10  6  1 14  2 11  5  1  4  5 11
    #> [126]  1 14 11  1  1  4 14 14  2 NA  5  4 12  5  1 14  2  5 13 12 11 NA  2  4 12
    #> [151]  4  5  2  1  8  5 14  1 12  2 10  1  8 14 14  6  5  5 13 14 14  9  3  5 12
    #> [176]  4 10 10 14 14  5  1  8 14  4  2  6  4 14  6 14  9 14  1  1 NA 11  1  1 14
    #> [201]  4  9  1 12  4 11  1  6  1  1  1 13  4 NA  6 14  1  1 14  7  6  1  1  1  4
    #> [226] 12 14 NA  1 14  3 14 14  3  5  1  6 14  8 13 NA  7  6 14  3 14  6  2 14  5
    #> [251]  2 14  2  4  1  2  7  3  1  1 13  4 NA 12 12 NA  2  1  1  7 12 10  2  1 11
    #> [276] NA  9  4  5  1  2  3 14 14  1  6 NA  1 NA 13 14  2  1  9 12  6 14  2 NA 14
    #> [301]  1 11  1 14  1  1  1  2  7  3 14  7 14  1 NA 14  5 10  4  1  1 14  9  2  4
    #> [326]  5  5  7  8 13 11  3 12 14  1  2  2  1 10  1  1 NA 13 NA  4  1  2  7  5  1
    #> [351]  9  1  1  5 11  1  1 14 11  5  5  8  1  4 13  8 14  5  1 12 13  3  5 14  9
    #> [376]  2 12 14  1 13  9  1 14  3  1  2  6  2  3  8 14  2  5  9  2  4  1 10  3  8
    #> [401]  1  1 10  3  1  1  1  1  2 14  2  7  3  3 14  1 14 13 14  2  6  3  1 14 14
    #> [426] 12  8 14  5  2  1  1 14  3 14  1  2  2 11  4  8  1 NA 13 NA  5  2  3  4 14
    #> [451]  5  1  1  1 NA  1  5  1 14 14  9  1 14  1  9 13  1 10 11  1  1 10  5  1  1
    #> [476]  3  1  3  5  7  3 14 14  2  2  3  4  1 12 NA  1 10  8 14 13 12  4 NA  1 NA

#### CAMSA skill + time score

The `get_camsa_skill_time_score()` function computes the CAMSA (Canadian Agility and Movement Skill Assessment) skill + time score for a given trial. This score is used to compute the CAMSA score.

    # Trial 1
    capl_demo_data$camsa_skill_time_score1 <- get_camsa_skill_time_score(
      camsa_skill_score = capl_demo_data$camsa_skill_score1,
      camsa_time_score = capl_demo_data$camsa_time_score1
    )

    # Trial 2
    capl_demo_data$camsa_skill_time_score2 <- get_camsa_skill_time_score(
      camsa_skill_score = capl_demo_data$camsa_skill_score2,
      camsa_time_score = capl_demo_data$camsa_time_score2
    )

    # Time scores for trial 1
    capl_demo_data$camsa_skill_time_score1
    #>   [1] 15  8 20 14  8 NA NA 22 12 24 15 24 24 18 13 24 11 18  9  5 10 16 19 21 NA
    #>  [26] 24 17 23 28  8 NA  6 NA  8  5  7  6 18 15 18 16 11 17 16  5  6 21 10  1 22
    #>  [51] 21  5 17 13 16 12 19 16 11 18 11 12 21 16 10 14 10 NA  9 NA 13 NA 17 21 17
    #>  [76] 18 18 15 NA 25 21 NA 10 14  5 20 15  7  9  6 14  7 NA  9  9 27  6 16 10 NA
    #> [101] NA 17 24 14  8 20 13 13 17 10  9 21 19 20 14 NA 21  6 25 15 19 15 14 19  8
    #> [126] NA 21 26 NA 23 17 NA 17 17  5 NA NA 18 NA NA 18 NA 14  8 15 27 NA 12 21 17
    #> [151]  8 NA 24 10 15  9 20 14 14 NA NA NA 18 15  9 17 21  9 23 13 23 10 27 NA 28
    #> [176] NA  8 25 21 19 12 13 12 13 25 14 25  8 16 15 15 26 18 23 11 19 NA NA 20 12
    #> [201] 12 16 12 19 15 16 16 17 25 10 18 23  8 17  3 25 19 15 21 14 28 16  6 20 19
    #> [226] 12 19 NA 16  9 NA 11 13 17  9 18 19 14 21 11 10 NA 11 11 13 14 11 14 12 26
    #> [251] 22 NA  5  6 13 NA 18 23 23  7 22 14 17 22  7  9  5 23 NA 28 15 22 15 15 16
    #> [276]  8 10 18 12 16 11 19 20 19 22 16  9  7 15 10 22 21  6 21 21 13  5 23 18 NA
    #> [301] 26 13  8  6 13 11 12 11 13  8 16 19 21 20 19 14  8  5 15 14 11  8 17 20 28
    #> [326] 15 13 16 21  6 12 22 24 22 20 12  9 13 21 17 18 15 15 20 15 10 NA 11 13 22
    #> [351] 10  9  7 15 16 25  9 18 NA 28  5  7 NA 21 24 12  7 28 NA 21  9 12 15 22 14
    #> [376] 12 19 11 16 13 18 12 12  9 20 17 NA 21 21 15 15 11  7 15 25 26 19 28 NA 28
    #> [401] 13  3 23 26 14 19  8 22  9 NA 26 17 11 11 10 20  5 27 14 NA  9 NA 11  6 20
    #> [426]  6 18 14 15 17  7  8 16 13 17 20 21  8  6 18 NA 10  6 18 13 16 20  7 25  6
    #> [451] NA NA 18  6 11 20 12 17 22 26 15 NA  9 17 NA 13 13  8  6 26 19  7 23 15  9
    #> [476] 12 16 10 15 12  7 11 12 12  9  8  9 15 NA 17  6 18 15 NA 19 14 22 22 14 15

    # Time scores for trial 2
    capl_demo_data$camsa_skill_time_score2
    #>   [1] 15 10 26 12 19 19  1  5  2 13 12 18 14 26 18 26 NA 14  8 10 18  9 25 13 11
    #>  [26] 13 NA 19 10  7  8 16 28 24 28 21 22 16 20 16 13 NA  3  8 27  6 14 23 24 16
    #>  [51] 12 28 20 20 NA 11 13 18 22  6  5  8 28  7 NA 21 17  5 21 16 NA 26 NA 12 12
    #>  [76] 13 17 10 12  5 NA  8 NA  8 NA  7  8 NA 18  9  5 15 19 14 13 16  9 22 19 17
    #> [101] 18 12  6 23 13 16 17  9 13 14 26 20 21 NA 14 15  5 15 14 23 13 14  7 13 22
    #> [126]  7 17 17 13 10 12 18 25 10 NA 16 10 18 14 12 25  7 17 26 21 23 NA 11 13 23
    #> [151] 11 19  8 11 22 11 21  9 22 12 24  6 18 24 26 NA 16  7 22 24 22 18 17 18 16
    #> [176] 12 19 17 25 27  9  5 11 27 13 11 15 11 26 10 18 11 22  7 12 NA 25 11  7 21
    #> [201] 16 16 12 23 15 22  7 14 15  9 12 19 16 NA 10 NA 10  3 NA 14 10  5  7  8 13
    #> [226] 18 22 NA 11 26 15 22 21 11 18 10 10 28 14 15 NA 15 14 21  9 27 15 11 24 18
    #> [251]  6 19 11 10 12  8 18  5 12  2 17 14 NA 14 18 NA 11  8  7 18 24 11 15 15 22
    #> [276] NA 20 18 16 15 11  8 23 19  5 14 NA 12 NA 19 22 12  5 18 22 19 23 11 NA NA
    #> [301]  6 20  8 19 13  7  7  8 21  5 NA 20 25  8 NA 18 11 15 18 11 10 27 14  8  8
    #> [326] 11 19 12 14 23 24 14 NA 28 13 NA  9  9 NA  6 12 NA 23 NA 18 10 11 11 12  9
    #> [351] 14  9 13 17 20 15 13 20 20 11 19 17 11 18 NA 12 23 10 12 25 21  8  9 27 17
    #> [376] 13 20 16  4 23 23  8 27 10 10 14 20 10 15 17 23 16 12 22 12  4  8 19  8 14
    #> [401] 14 14 19 12 11 11  1 13  6 26  2 12 11 16 21 NA 26 14 18 10 19 13  7 28 26
    #> [426] 16 14 14 13 12 14  7 24 16 16 15 15  8 11 10 15  9 NA 19 NA 10  9 10 15 25
    #> [451] 10  6 13 13 NA 12 14  6 18 19 19 13 20  2 23 24 15 20 23  8  6 20 15  7  8
    #> [476] 16 10 16 19 16 13 24 18 15  8 NA 16  7 12 NA  8 12 15 18 22 21 11 NA 15 NA

#### CAMSA score

The `get_camsa_score()` function computes the maximum CAMSA (Canadian Agility and Movement Skill Assessment) skill + time score for two trials and then divides by 2.8 so that the score is out of 10. This score is used to compute the physical literacy score.

    capl_demo_data$camsa_score <- get_camsa_score(
      camsa_skill_time_score1 = capl_demo_data$camsa_skill_time_score1,
      camsa_skill_time_score2 = capl_demo_data$camsa_skill_time_score2
    )

    capl_demo_data$camsa_score
    #>   [1]  5.357143  3.571429  9.285714  5.000000  6.785714        NA        NA
    #>   [8]  7.857143  4.285714  8.571429  5.357143  8.571429  8.571429  9.285714
    #>  [15]  6.428571  9.285714        NA  6.428571  3.214286  3.571429  6.428571
    #>  [22]  5.714286  8.928571  7.500000        NA  8.571429        NA  8.214286
    #>  [29] 10.000000  2.857143        NA  5.714286        NA  8.571429 10.000000
    #>  [36]  7.500000  7.857143  6.428571  7.142857  6.428571  5.714286        NA
    #>  [43]  6.071429  5.714286  9.642857  2.142857  7.500000  8.214286  8.571429
    #>  [50]  7.857143  7.500000 10.000000  7.142857  7.142857        NA  4.285714
    #>  [57]  6.785714  6.428571  7.857143  6.428571  3.928571  4.285714 10.000000
    #>  [64]  5.714286        NA  7.500000  6.071429        NA  7.500000        NA
    #>  [71]        NA        NA        NA  7.500000  6.071429  6.428571  6.428571
    #>  [78]  5.357143        NA  8.928571        NA        NA        NA  5.000000
    #>  [85]        NA  7.142857  5.357143        NA  6.428571  3.214286  5.000000
    #>  [92]  5.357143        NA  5.000000  4.642857  9.642857  3.214286  7.857143
    #>  [99]  6.785714        NA        NA  6.071429  8.571429  8.214286  4.642857
    #> [106]  7.142857  6.071429  4.642857  6.071429  5.000000  9.285714  7.500000
    #> [113]  7.500000        NA  5.000000        NA  7.500000  5.357143  8.928571
    #> [120]  8.214286  6.785714  5.357143  5.000000  6.785714  7.857143        NA
    #> [127]  7.500000  9.285714        NA  8.214286  6.071429        NA  8.928571
    #> [134]  6.071429        NA        NA        NA  6.428571        NA        NA
    #> [141]  8.928571        NA  6.071429  9.285714  7.500000  9.642857        NA
    #> [148]  4.285714  7.500000  8.214286  3.928571        NA  8.571429  3.928571
    #> [155]  7.857143  3.928571  7.500000  5.000000  7.857143        NA        NA
    #> [162]        NA  6.428571  8.571429  9.285714        NA  7.500000  3.214286
    #> [169]  8.214286  8.571429  8.214286  6.428571  9.642857        NA 10.000000
    #> [176]        NA  6.785714  8.928571  8.928571  9.642857  4.285714  4.642857
    #> [183]  4.285714  9.642857  8.928571  5.000000  8.928571  3.928571  9.285714
    #> [190]  5.357143  6.428571  9.285714  7.857143  8.214286  4.285714        NA
    #> [197]        NA        NA  7.142857  7.500000  5.714286  5.714286  4.285714
    #> [204]  8.214286  5.357143  7.857143  5.714286  6.071429  8.928571  3.571429
    #> [211]  6.428571  8.214286  5.714286        NA  3.571429        NA  6.785714
    #> [218]  5.357143        NA  5.000000 10.000000  5.714286  2.500000  7.142857
    #> [225]  6.785714  6.428571  7.857143        NA  5.714286  9.285714        NA
    #> [232]  7.857143  7.500000  6.071429  6.428571  6.428571  6.785714 10.000000
    #> [239]  7.500000  5.357143        NA        NA  5.000000  7.500000  4.642857
    #> [246]  9.642857  5.357143  5.000000  8.571429  9.285714  7.857143        NA
    #> [253]  3.928571  3.571429  4.642857        NA  6.428571  8.214286  8.214286
    #> [260]  2.500000  7.857143  5.000000        NA  7.857143  6.428571        NA
    #> [267]  3.928571  8.214286        NA 10.000000  8.571429  7.857143  5.357143
    #> [274]  5.357143  7.857143        NA  7.142857  6.428571  5.714286  5.714286
    #> [281]  3.928571  6.785714  8.214286  6.785714  7.857143  5.714286        NA
    #> [288]  4.285714        NA  6.785714  7.857143  7.500000  2.142857  7.500000
    #> [295]  7.857143  6.785714  8.214286  8.214286        NA        NA  9.285714
    #> [302]  7.142857  2.857143  6.785714  4.642857  3.928571  4.285714  3.928571
    #> [309]  7.500000  2.857143        NA  7.142857  8.928571  7.142857        NA
    #> [316]  6.428571  3.928571  5.357143  6.428571  5.000000  3.928571  9.642857
    #> [323]  6.071429  7.142857 10.000000  5.357143  6.785714  5.714286  7.500000
    #> [330]  8.214286  8.571429  7.857143        NA 10.000000  7.142857        NA
    #> [337]  3.214286  4.642857        NA  6.071429  6.428571        NA  8.214286
    #> [344]        NA  6.428571  3.571429        NA  3.928571  4.642857  7.857143
    #> [351]  5.000000  3.214286  4.642857  6.071429  7.142857  8.928571  4.642857
    #> [358]  7.142857        NA 10.000000  6.785714  6.071429        NA  7.500000
    #> [365]        NA  4.285714  8.214286 10.000000        NA  8.928571  7.500000
    #> [372]  4.285714  5.357143  9.642857  6.071429  4.642857  7.142857  5.714286
    #> [379]  5.714286  8.214286  8.214286  4.285714  9.642857  3.571429  7.142857
    #> [386]  6.071429        NA  7.500000  7.500000  6.071429  8.214286  5.714286
    #> [393]  4.285714  7.857143  8.928571  9.285714  6.785714 10.000000        NA
    #> [400] 10.000000  5.000000  5.000000  8.214286  9.285714  5.000000  6.785714
    #> [407]  2.857143  7.857143  3.214286        NA  9.285714  6.071429  3.928571
    #> [414]  5.714286  7.500000        NA  9.285714  9.642857  6.428571        NA
    #> [421]  6.785714        NA  3.928571 10.000000  9.285714  5.714286  6.428571
    #> [428]  5.000000  5.357143  6.071429  5.000000  2.857143  8.571429  5.714286
    #> [435]  6.071429  7.142857  7.500000  2.857143  3.928571  6.428571        NA
    #> [442]  3.571429        NA  6.785714        NA  5.714286  7.142857  3.571429
    #> [449]  8.928571  8.928571        NA        NA  6.428571  4.642857        NA
    #> [456]  7.142857  5.000000  6.071429  7.857143  9.285714  6.785714        NA
    #> [463]  7.142857  6.071429        NA  8.571429  5.357143  7.142857  8.214286
    #> [470]  9.285714  6.785714  7.142857  8.214286  5.357143  3.214286  5.714286
    #> [477]  5.714286  5.714286  6.785714  5.714286  4.642857  8.571429  6.428571
    #> [484]  5.357143  3.214286        NA  5.714286  5.357143        NA        NA
    #> [491]  2.857143  6.428571  5.357143        NA  7.857143  7.500000  7.857143
    #> [498]        NA  5.357143        NA

#### CAMSA interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$camsa_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$camsa_score,
      protocol = "camsa"
    )

    capl_demo_data$camsa_interpretation
    #>   [1] "beginning"   "beginning"   "excelling"   "beginning"   "progressing"
    #>   [6] NA            NA            "progressing" "beginning"   "excelling"
    #>  [11] NA            "achieving"   NA            NA            "progressing"
    #>  [16] "excelling"   NA            "progressing" "beginning"   "beginning"
    #>  [21] "progressing" "beginning"   "excelling"   NA            NA
    #>  [26] NA            NA            NA            "excelling"   "beginning"
    #>  [31] NA            "beginning"   NA            NA            "excelling"
    #>  [36] NA            NA            "progressing" "progressing" "progressing"
    #>  [41] "beginning"   NA            "progressing" "beginning"   "excelling"
    #>  [46] "beginning"   "progressing" "achieving"   NA            NA
    #>  [51] "achieving"   "excelling"   "progressing" "progressing" NA
    #>  [56] "beginning"   "progressing" "progressing" "progressing" "progressing"
    #>  [61] "beginning"   NA            "excelling"   "progressing" NA
    #>  [66] NA            "progressing" NA            NA            NA
    #>  [71] NA            NA            NA            "progressing" NA
    #>  [76] "progressing" NA            "progressing" NA            "achieving"
    #>  [81] NA            NA            NA            "beginning"   NA
    #>  [86] NA            "beginning"   NA            "progressing" "beginning"
    #>  [91] "beginning"   "beginning"   NA            NA            NA
    #>  [96] "excelling"   NA            "achieving"   "progressing" NA
    #> [101] NA            "beginning"   "achieving"   NA            "beginning"
    #> [106] "progressing" "progressing" "beginning"   "progressing" "beginning"
    #> [111] "excelling"   "achieving"   "progressing" NA            "beginning"
    #> [116] NA            "progressing" "beginning"   "achieving"   "achieving"
    #> [121] NA            "beginning"   "beginning"   "progressing" "progressing"
    #> [126] NA            "progressing" NA            NA            "progressing"
    #> [131] "progressing" NA            "excelling"   "beginning"   NA
    #> [136] NA            NA            "progressing" NA            NA
    #> [141] "excelling"   NA            "progressing" "excelling"   "progressing"
    #> [146] "excelling"   NA            NA            "progressing" "progressing"
    #> [151] "beginning"   NA            "progressing" "beginning"   "progressing"
    #> [156] "beginning"   "progressing" "beginning"   "excelling"   NA
    #> [161] NA            NA            "progressing" "excelling"   NA
    #> [166] NA            "progressing" NA            "achieving"   "achieving"
    #> [171] "progressing" "progressing" "excelling"   NA            "excelling"
    #> [176] NA            "progressing" NA            NA            "excelling"
    #> [181] "beginning"   NA            "beginning"   NA            "achieving"
    #> [186] "beginning"   "excelling"   "beginning"   "excelling"   NA
    #> [191] "progressing" "achieving"   "progressing" "progressing" NA
    #> [196] NA            NA            NA            "progressing" NA
    #> [201] "beginning"   "progressing" "beginning"   "achieving"   "beginning"
    #> [206] "progressing" "progressing" "beginning"   "achieving"   NA
    #> [211] NA            "excelling"   "beginning"   NA            "beginning"
    #> [216] NA            NA            "progressing" NA            "beginning"
    #> [221] "excelling"   "beginning"   NA            NA            "progressing"
    #> [226] "progressing" "achieving"   NA            "beginning"   NA
    #> [231] NA            "progressing" "progressing" "beginning"   "progressing"
    #> [236] "progressing" "progressing" "excelling"   "progressing" "beginning"
    #> [241] NA            NA            NA            NA            NA
    #> [246] "excelling"   "beginning"   NA            NA            "excelling"
    #> [251] NA            NA            NA            "beginning"   "beginning"
    #> [256] NA            "progressing" "progressing" "progressing" NA
    #> [261] "progressing" "beginning"   NA            "achieving"   "progressing"
    #> [266] NA            "beginning"   "progressing" NA            "excelling"
    #> [271] "excelling"   "progressing" NA            "beginning"   "progressing"
    #> [276] NA            "progressing" "progressing" "beginning"   "beginning"
    #> [281] "beginning"   NA            "progressing" "progressing" "progressing"
    #> [286] "beginning"   NA            "beginning"   NA            "progressing"
    #> [291] "progressing" "progressing" "beginning"   "progressing" NA
    #> [296] "progressing" "excelling"   "achieving"   NA            NA
    #> [301] "excelling"   "progressing" "beginning"   "progressing" "beginning"
    #> [306] "beginning"   "beginning"   NA            NA            "beginning"
    #> [311] NA            "progressing" "achieving"   "progressing" NA
    #> [316] "progressing" "beginning"   "beginning"   "progressing" NA
    #> [321] "beginning"   "excelling"   "beginning"   "progressing" "excelling"
    #> [326] NA            "progressing" "progressing" "progressing" "excelling"
    #> [331] "achieving"   "excelling"   NA            "excelling"   "progressing"
    #> [336] NA            "beginning"   "beginning"   NA            "beginning"
    #> [341] NA            NA            "achieving"   NA            "progressing"
    #> [346] "beginning"   NA            "beginning"   "beginning"   "progressing"
    #> [351] NA            NA            "beginning"   "progressing" "progressing"
    #> [356] "excelling"   NA            "progressing" NA            "excelling"
    #> [361] NA            "progressing" NA            "progressing" NA
    #> [366] "beginning"   "achieving"   "excelling"   NA            "excelling"
    #> [371] "progressing" "beginning"   "beginning"   NA            "progressing"
    #> [376] "beginning"   "progressing" NA            NA            "progressing"
    #> [381] "progressing" "beginning"   "excelling"   "beginning"   "progressing"
    #> [386] "progressing" NA            NA            "achieving"   "progressing"
    #> [391] "excelling"   "beginning"   NA            "achieving"   "achieving"
    #> [396] "excelling"   "progressing" NA            NA            "excelling"
    #> [401] NA            "beginning"   "excelling"   "excelling"   "beginning"
    #> [406] "progressing" NA            "achieving"   "beginning"   NA
    #> [411] NA            "progressing" "beginning"   "beginning"   "progressing"
    #> [416] NA            "excelling"   "excelling"   "progressing" NA
    #> [421] "progressing" NA            "beginning"   "excelling"   "excelling"
    #> [426] "progressing" "progressing" "beginning"   "beginning"   "beginning"
    #> [431] "beginning"   "beginning"   "achieving"   NA            "beginning"
    #> [436] "progressing" "progressing" "beginning"   "beginning"   "progressing"
    #> [441] NA            "beginning"   NA            "progressing" NA
    #> [446] "beginning"   "progressing" "beginning"   "achieving"   NA
    #> [451] NA            NA            NA            "beginning"   NA
    #> [456] "progressing" "beginning"   "beginning"   "progressing" "excelling"
    #> [461] NA            NA            "progressing" "progressing" NA
    #> [466] "achieving"   "beginning"   NA            NA            NA
    #> [471] "progressing" "progressing" NA            "beginning"   "beginning"
    #> [476] "beginning"   NA            "beginning"   "progressing" "beginning"
    #> [481] NA            "excelling"   "progressing" NA            "beginning"
    #> [486] NA            "beginning"   NA            NA            NA
    #> [491] "beginning"   "progressing" "beginning"   NA            "achieving"
    #> [496] "progressing" NA            NA            "beginning"   NA

#### Physical competence score

The `get_pc_score()` function computes a physical competence domain score that ranges from zero to 30 based on the PACER (Progressive Aerobic Cardiovascular Endurance Run), plank and CAMSA (Canadian Agility and Movement Skill Assessment) scores. If one protocol score is missing or invalid, a weighted domain score will be computed from the other two protocol scores. This score is used to compute the physical competence domain score.

    capl_demo_data$pc_score <- get_pc_score(
      pacer_score = capl_demo_data$pacer_score,
      plank_score = capl_demo_data$plank_score,
      camsa_score = capl_demo_data$camsa_score
    )

    capl_demo_data$pc_score
    #>   [1] 19.5 24.0 15.0 22.0 30.0 16.5  9.0 30.0  9.0   NA 30.0 30.0 25.5 19.5   NA
    #>  [16] 30.0 30.0 30.0 15.0 30.0 30.0 22.5 19.5 28.5 13.5 30.0 30.0 15.0 30.0 22.5
    #>  [31] 15.0  1.5 22.5 19.5 25.0 30.0 21.0 24.0 30.0 15.0 24.0 30.0 15.0 30.0 27.0
    #>  [46] 24.0 15.0 30.0 15.0 30.0 21.0 29.0 30.0 30.0 30.0 30.0 18.0 30.0 30.0 30.0
    #>  [61] 30.0 27.0 20.0 25.5 21.0 30.0  3.0 28.5 15.0 24.0   NA 30.0 25.5 27.0 21.0
    #>  [76] 30.0 30.0 16.5 13.5 15.0 21.0 24.0 30.0 25.0 24.0 25.5 27.0 30.0 30.0 12.0
    #>  [91] 15.0 30.0 25.5 22.5  3.0 24.0 27.0 15.0 27.0   NA 21.0 30.0 15.0 30.0 15.0
    #> [106] 15.0 28.5 30.0 19.5 16.0 30.0 22.5 30.0 27.0 11.0 30.0 25.5 30.0 24.0 15.0
    #> [121] 30.0 30.0 15.0 30.0 30.0 24.0 30.0 30.0 30.0 30.0 22.5 30.0 18.0 30.0 15.0
    #> [136] 30.0 25.5 15.0 30.0 25.5 15.0 30.0   NA 30.0 21.0 19.5 30.0 30.0 15.0 16.5
    #> [151] 16.5 30.0 30.0 22.5 18.0 30.0 13.5 25.0 30.0 30.0 30.0 16.5 25.5 15.0 15.0
    #> [166] 30.0 30.0 15.0 12.0 22.5 30.0 30.0 16.5 30.0 30.0 22.5 30.0 30.0 30.0 18.0
    #> [181] 16.5 15.0 25.5 30.0 30.0 25.0 30.0 30.0 30.0 30.0 24.0 19.5 12.0 21.0 27.0
    #> [196] 16.5 30.0 19.5 30.0 27.0  4.5  7.5 30.0 21.0 30.0 19.5 30.0 19.5   NA 15.0
    #> [211] 30.0 13.5 25.5 30.0 30.0   NA 22.5 13.5 30.0 25.0 27.0 15.0   NA 30.0 13.5
    #> [226] 30.0 30.0 28.5 18.0 21.0   NA  9.0 21.0 10.5 30.0 22.5 15.0 26.0 30.0 30.0
    #> [241] 30.0 15.0 22.5 30.0 27.0 30.0 16.5 25.0   NA 30.0 30.0 30.0 18.0 30.0 15.0
    #> [256] 30.0 30.0 27.0   NA 30.0 30.0 23.0 25.5   NA 30.0 19.5  9.0 30.0 30.0 24.0
    #> [271] 19.5 30.0 30.0 28.5 19.5 21.0 21.0 30.0 30.0 30.0 30.0 22.5 27.0 30.0 30.0
    #> [286] 30.0 30.0 16.5 24.0 30.0 27.0 30.0 15.0 30.0 25.5 18.0 30.0 15.0 30.0 30.0
    #> [301] 15.0 22.5 30.0 24.0 30.0 30.0 30.0 30.0 30.0 27.0 24.0 30.0 30.0 22.5 12.0
    #> [316] 25.5 27.0 30.0 30.0 25.0 30.0 30.0   NA 28.5 30.0 30.0 22.5  3.0 15.0 27.0
    #> [331] 30.0 30.0 15.0 23.0 30.0 15.0 16.5 30.0 25.5   NA 15.0 30.0 30.0 30.0 30.0
    #> [346] 30.0 30.0 15.0 15.0 30.0 25.0 30.0 30.0 28.5 28.5 18.0 30.0 30.0 30.0 27.0
    #> [361] 28.5 30.0 15.0 28.5 28.5 24.0 15.0 14.0   NA 30.0 30.0 19.5 16.5 30.0 30.0
    #> [376] 19.5 30.0 30.0 30.0 30.0 25.5 24.0 30.0 30.0   NA 30.0 30.0   NA 13.5 13.5
    #> [391] 30.0 30.0 30.0 30.0 28.5   NA 18.0 30.0 19.5 24.0 22.0 20.0 28.5 30.0 25.0
    #> [406] 15.0 30.0 30.0 30.0 30.0 30.0 30.0 24.0 21.0 30.0 15.0 30.0 21.0 30.0 27.0
    #> [421] 18.0  7.5 19.5 30.0 12.0 30.0 30.0 23.0 30.0 24.0 22.5 30.0 19.5 30.0 27.0
    #> [436] 30.0 30.0 30.0 30.0 16.5 12.0   NA 18.0 30.0 21.0 24.0 30.0 15.0 30.0   NA
    #> [451] 30.0 18.0 28.5 27.0 21.0 30.0 18.0 30.0 24.0 13.5  7.5 22.5 30.0 21.0 18.0
    #> [466]  3.0 19.5 28.5   NA 15.0 25.5 30.0 24.0   NA 19.5 15.0 18.0 30.0 30.0 27.0
    #> [481] 30.0 18.0   NA 24.0 27.0   NA 18.0 19.5 30.0 19.5 24.0 21.0 30.0 30.0 21.0
    #> [496]   NA 30.0 18.0 30.0 13.5

#### Physical competence interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$pc_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$pc_score,
      protocol = "pc"
    )

    capl_demo_data$pc_interpretation
    #>   [1] "achieving"   "excelling"   "progressing" "excelling"   "excelling"
    #>   [6] "progressing" "beginning"   "excelling"   "beginning"   NA
    #>  [11] NA            "excelling"   NA            NA            NA
    #>  [16] "excelling"   "excelling"   "excelling"   "progressing" "excelling"
    #>  [21] "excelling"   "excelling"   "achieving"   NA            NA
    #>  [26] NA            "excelling"   NA            "excelling"   "achieving"
    #>  [31] "progressing" "beginning"   "excelling"   NA            "excelling"
    #>  [36] NA            NA            "excelling"   "excelling"   "progressing"
    #>  [41] "excelling"   "excelling"   "progressing" "excelling"   "excelling"
    #>  [46] "excelling"   "progressing" "excelling"   NA            NA
    #>  [51] "excelling"   "excelling"   "excelling"   "excelling"   "excelling"
    #>  [56] "excelling"   "progressing" "excelling"   "excelling"   "excelling"
    #>  [61] "excelling"   NA            "achieving"   "excelling"   "achieving"
    #>  [66] NA            "beginning"   "excelling"   NA            "excelling"
    #>  [71] NA            "excelling"   "excelling"   "excelling"   NA
    #>  [76] "excelling"   NA            "progressing" "beginning"   "progressing"
    #>  [81] NA            "excelling"   "excelling"   "excelling"   "achieving"
    #>  [86] NA            "excelling"   "excelling"   "excelling"   "beginning"
    #>  [91] "progressing" "excelling"   NA            NA            NA
    #>  [96] "excelling"   NA            "progressing" "excelling"   NA
    #> [101] "achieving"   "excelling"   "progressing" NA            "progressing"
    #> [106] "progressing" "excelling"   "excelling"   "progressing" "progressing"
    #> [111] "excelling"   "excelling"   "excelling"   NA            "beginning"
    #> [116] "excelling"   "excelling"   "excelling"   "excelling"   "progressing"
    #> [121] NA            "excelling"   "progressing" "excelling"   "excelling"
    #> [126] NA            "excelling"   NA            NA            "excelling"
    #> [131] "achieving"   NA            "progressing" "excelling"   "progressing"
    #> [136] "excelling"   "excelling"   "progressing" "excelling"   "excelling"
    #> [141] "progressing" "excelling"   NA            "excelling"   "progressing"
    #> [146] "achieving"   NA            NA            "progressing" "progressing"
    #> [151] "progressing" "excelling"   "excelling"   "achieving"   "progressing"
    #> [156] "excelling"   "beginning"   "excelling"   "excelling"   "excelling"
    #> [161] NA            "progressing" "excelling"   "progressing" NA
    #> [166] "excelling"   "excelling"   NA            "beginning"   "achieving"
    #> [171] "excelling"   "excelling"   "progressing" "excelling"   "excelling"
    #> [176] "excelling"   "excelling"   NA            NA            "progressing"
    #> [181] "progressing" NA            "excelling"   NA            "excelling"
    #> [186] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [191] "excelling"   "progressing" "beginning"   "progressing" NA
    #> [196] "progressing" "excelling"   "progressing" "excelling"   NA
    #> [201] "beginning"   "beginning"   "excelling"   "achieving"   "excelling"
    #> [206] "achieving"   "excelling"   "progressing" NA            NA
    #> [211] NA            "progressing" "excelling"   "excelling"   "excelling"
    #> [216] NA            NA            "progressing" "excelling"   "excelling"
    #> [221] "excelling"   "progressing" NA            NA            "beginning"
    #> [226] "excelling"   "excelling"   NA            "progressing" NA
    #> [231] NA            "beginning"   "achieving"   "beginning"   "excelling"
    #> [236] "excelling"   "progressing" "excelling"   "excelling"   "excelling"
    #> [241] "excelling"   "progressing" NA            NA            NA
    #> [246] "excelling"   "progressing" NA            NA            "excelling"
    #> [251] NA            "excelling"   NA            "excelling"   "progressing"
    #> [256] "excelling"   "excelling"   "excelling"   NA            NA
    #> [261] "excelling"   "excelling"   "excelling"   NA            "excelling"
    #> [266] "achieving"   "beginning"   "excelling"   "excelling"   "excelling"
    #> [271] "achieving"   "excelling"   NA            "excelling"   "progressing"
    #> [276] "achieving"   "progressing" "excelling"   "excelling"   "excelling"
    #> [281] "excelling"   NA            "excelling"   "excelling"   "excelling"
    #> [286] "excelling"   "excelling"   "progressing" "excelling"   "excelling"
    #> [291] "excelling"   "excelling"   "progressing" "excelling"   NA
    #> [296] "progressing" "excelling"   "progressing" "excelling"   "excelling"
    #> [301] "progressing" "achieving"   "excelling"   "excelling"   "excelling"
    #> [306] "excelling"   "excelling"   NA            NA            "excelling"
    #> [311] "excelling"   "excelling"   "excelling"   "achieving"   "beginning"
    #> [316] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [321] "excelling"   "excelling"   NA            "excelling"   "excelling"
    #> [326] NA            "achieving"   "beginning"   "progressing" "excelling"
    #> [331] "excelling"   "excelling"   "progressing" "achieving"   "excelling"
    #> [336] "beginning"   "progressing" "excelling"   "excelling"   NA
    #> [341] NA            NA            "excelling"   "excelling"   "excelling"
    #> [346] "excelling"   "excelling"   "progressing" "progressing" "excelling"
    #> [351] NA            NA            "excelling"   "excelling"   "excelling"
    #> [356] "progressing" NA            "excelling"   "excelling"   "excelling"
    #> [361] NA            "excelling"   NA            "excelling"   "excelling"
    #> [366] "excelling"   "progressing" "progressing" NA            "excelling"
    #> [371] "excelling"   "achieving"   "progressing" NA            "excelling"
    #> [376] "progressing" "excelling"   NA            NA            "excelling"
    #> [381] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [386] "excelling"   "excelling"   NA            "progressing" "beginning"
    #> [391] "excelling"   "excelling"   NA            "excelling"   "excelling"
    #> [396] NA            "progressing" NA            "progressing" "excelling"
    #> [401] NA            "achieving"   "excelling"   "excelling"   "excelling"
    #> [406] "progressing" NA            "excelling"   "excelling"   "excelling"
    #> [411] NA            "excelling"   "excelling"   "achieving"   "excelling"
    #> [416] "progressing" "excelling"   "excelling"   "excelling"   NA
    #> [421] "progressing" "beginning"   "achieving"   "excelling"   "beginning"
    #> [426] "excelling"   "excelling"   "excelling"   "excelling"   "excelling"
    #> [431] "excelling"   "excelling"   "progressing" NA            "excelling"
    #> [436] "excelling"   "excelling"   "excelling"   "excelling"   "progressing"
    #> [441] "beginning"   NA            "progressing" "excelling"   "achieving"
    #> [446] "excelling"   "excelling"   "progressing" "excelling"   NA
    #> [451] "excelling"   "progressing" NA            "excelling"   "excelling"
    #> [456] "excelling"   "progressing" "excelling"   "excelling"   "beginning"
    #> [461] NA            "excelling"   "excelling"   "achieving"   NA
    #> [466] "beginning"   "progressing" NA            NA            NA
    #> [471] "excelling"   "excelling"   NA            NA            "progressing"
    #> [476] "progressing" NA            "excelling"   "excelling"   "excelling"
    #> [481] NA            "progressing" NA            NA            "excelling"
    #> [486] NA            "progressing" NA            "excelling"   "progressing"
    #> [491] "excelling"   "achieving"   "excelling"   "excelling"   "excelling"
    #> [496] NA            NA            NA            "excelling"   "beginning"

#### Physical competence domain status

The `get_capl_domain_status()` function computes the status (“complete”, “missing interpretation”, “missing protocol” or “incomplete”) of a CAPL domain.

    capl_demo_data$pc_status <- get_capl_domain_status(
      x = capl_demo_data,
      domain = "pc"
    )

    capl_demo_data$pc_status
    #>   [1] "complete"               "complete"               "complete"
    #>   [4] "complete"               "complete"               "missing protocol"
    #>   [7] "missing protocol"       "complete"               "complete"
    #>  [10] "incomplete"             "missing interpretation" "complete"
    #>  [13] "missing interpretation" "missing interpretation" "incomplete"
    #>  [16] "complete"               "missing protocol"       "complete"
    #>  [19] "complete"               "complete"               "complete"
    #>  [22] "complete"               "complete"               "missing interpretation"
    #>  [25] "missing interpretation" "missing interpretation" "missing protocol"
    #>  [28] "missing interpretation" "complete"               "complete"
    #>  [31] "missing protocol"       "complete"               "missing protocol"
    #>  [34] "missing interpretation" "complete"               "missing interpretation"
    #>  [37] "missing interpretation" "complete"               "complete"
    #>  [40] "complete"               "complete"               "missing protocol"
    #>  [43] "complete"               "complete"               "complete"
    #>  [46] "complete"               "complete"               "complete"
    #>  [49] "missing interpretation" "missing interpretation" "complete"
    #>  [52] "complete"               "complete"               "complete"
    #>  [55] "missing protocol"       "complete"               "complete"
    #>  [58] "complete"               "complete"               "complete"
    #>  [61] "complete"               "missing interpretation" "complete"
    #>  [64] "complete"               "missing protocol"       "missing interpretation"
    #>  [67] "complete"               "missing protocol"       "missing interpretation"
    #>  [70] "missing protocol"       "incomplete"             "missing protocol"
    #>  [73] "missing protocol"       "complete"               "missing interpretation"
    #>  [76] "complete"               "missing interpretation" "complete"
    #>  [79] "missing protocol"       "complete"               "missing interpretation"
    #>  [82] "missing protocol"       "missing protocol"       "complete"
    #>  [85] "missing protocol"       "missing interpretation" "complete"
    #>  [88] "missing protocol"       "complete"               "complete"
    #>  [91] "complete"               "complete"               "missing interpretation"
    #>  [94] "missing interpretation" "missing interpretation" "complete"
    #>  [97] "missing interpretation" "complete"               "complete"
    #> [100] "incomplete"             "missing protocol"       "complete"
    #> [103] "complete"               "missing interpretation" "complete"
    #> [106] "complete"               "complete"               "complete"
    #> [109] "complete"               "complete"               "complete"
    #> [112] "complete"               "complete"               "missing interpretation"
    #> [115] "complete"               "missing protocol"       "complete"
    #> [118] "complete"               "complete"               "complete"
    #> [121] "missing interpretation" "complete"               "complete"
    #> [124] "complete"               "complete"               "missing interpretation"
    #> [127] "complete"               "missing interpretation" "missing interpretation"
    #> [130] "complete"               "complete"               "missing interpretation"
    #> [133] "complete"               "complete"               "missing protocol"
    #> [136] "missing protocol"       "missing protocol"       "complete"
    #> [139] "missing protocol"       "missing protocol"       "complete"
    #> [142] "missing protocol"       "incomplete"             "complete"
    #> [145] "complete"               "complete"               "missing interpretation"
    #> [148] "missing interpretation" "complete"               "complete"
    #> [151] "complete"               "missing protocol"       "complete"
    #> [154] "complete"               "complete"               "complete"
    #> [157] "complete"               "complete"               "complete"
    #> [160] "missing protocol"       "missing interpretation" "missing protocol"
    #> [163] "complete"               "complete"               "missing interpretation"
    #> [166] "missing protocol"       "complete"               "missing interpretation"
    #> [169] "complete"               "complete"               "complete"
    #> [172] "complete"               "complete"               "missing protocol"
    #> [175] "complete"               "missing protocol"       "complete"
    #> [178] "missing interpretation" "missing interpretation" "complete"
    #> [181] "complete"               "missing interpretation" "complete"
    #> [184] "missing interpretation" "complete"               "complete"
    #> [187] "complete"               "complete"               "complete"
    #> [190] "missing interpretation" "complete"               "complete"
    #> [193] "complete"               "complete"               "missing interpretation"
    #> [196] "missing protocol"       "missing protocol"       "missing protocol"
    #> [199] "complete"               "missing interpretation" "complete"
    #> [202] "complete"               "complete"               "complete"
    #> [205] "complete"               "complete"               "complete"
    #> [208] "complete"               "incomplete"             "missing interpretation"
    #> [211] "missing interpretation" "complete"               "complete"
    #> [214] "missing protocol"       "complete"               "incomplete"
    #> [217] "missing interpretation" "complete"               "missing protocol"
    #> [220] "complete"               "complete"               "complete"
    #> [223] "incomplete"             "missing interpretation" "complete"
    #> [226] "complete"               "complete"               "missing interpretation"
    #> [229] "complete"               "missing interpretation" "incomplete"
    #> [232] "complete"               "complete"               "complete"
    #> [235] "complete"               "complete"               "complete"
    #> [238] "complete"               "complete"               "complete"
    #> [241] "missing protocol"       "missing protocol"       "missing interpretation"
    #> [244] "missing interpretation" "missing interpretation" "complete"
    #> [247] "complete"               "missing interpretation" "incomplete"
    #> [250] "complete"               "missing interpretation" "missing protocol"
    #> [253] "missing interpretation" "complete"               "complete"
    #> [256] "missing protocol"       "complete"               "complete"
    #> [259] "incomplete"             "missing interpretation" "complete"
    #> [262] "complete"               "missing protocol"       "incomplete"
    #> [265] "complete"               "missing protocol"       "complete"
    #> [268] "complete"               "missing protocol"       "complete"
    #> [271] "complete"               "complete"               "missing interpretation"
    #> [274] "complete"               "complete"               "missing protocol"
    #> [277] "complete"               "complete"               "complete"
    #> [280] "complete"               "complete"               "missing interpretation"
    #> [283] "complete"               "complete"               "complete"
    #> [286] "complete"               "missing protocol"       "complete"
    #> [289] "missing protocol"       "complete"               "complete"
    #> [292] "complete"               "complete"               "complete"
    #> [295] "missing interpretation" "complete"               "complete"
    #> [298] "complete"               "missing protocol"       "missing protocol"
    #> [301] "complete"               "complete"               "complete"
    #> [304] "complete"               "complete"               "complete"
    #> [307] "complete"               "missing interpretation" "missing interpretation"
    #> [310] "complete"               "missing protocol"       "complete"
    #> [313] "complete"               "complete"               "missing protocol"
    #> [316] "complete"               "complete"               "complete"
    #> [319] "complete"               "missing interpretation" "complete"
    #> [322] "complete"               "incomplete"             "complete"
    #> [325] "complete"               "missing interpretation" "complete"
    #> [328] "complete"               "complete"               "complete"
    #> [331] "complete"               "complete"               "missing protocol"
    #> [334] "complete"               "complete"               "missing protocol"
    #> [337] "complete"               "complete"               "missing protocol"
    #> [340] "incomplete"             "missing interpretation" "missing interpretation"
    #> [343] "complete"               "missing protocol"       "complete"
    #> [346] "complete"               "missing protocol"       "complete"
    #> [349] "complete"               "complete"               "missing interpretation"
    #> [352] "missing interpretation" "complete"               "complete"
    #> [355] "complete"               "complete"               "missing interpretation"
    #> [358] "complete"               "missing protocol"       "complete"
    #> [361] "missing interpretation" "complete"               "missing interpretation"
    #> [364] "complete"               "missing protocol"       "complete"
    #> [367] "complete"               "complete"               "incomplete"
    #> [370] "complete"               "complete"               "complete"
    #> [373] "complete"               "missing interpretation" "complete"
    #> [376] "complete"               "complete"               "missing interpretation"
    #> [379] "missing interpretation" "complete"               "complete"
    #> [382] "complete"               "complete"               "complete"
    #> [385] "incomplete"             "complete"               "missing protocol"
    #> [388] "incomplete"             "complete"               "complete"
    #> [391] "complete"               "complete"               "missing interpretation"
    #> [394] "complete"               "complete"               "incomplete"
    #> [397] "complete"               "missing interpretation" "missing protocol"
    #> [400] "complete"               "missing interpretation" "complete"
    #> [403] "complete"               "complete"               "complete"
    #> [406] "complete"               "missing interpretation" "complete"
    #> [409] "complete"               "missing protocol"       "missing interpretation"
    #> [412] "complete"               "complete"               "complete"
    #> [415] "complete"               "missing protocol"       "complete"
    #> [418] "complete"               "complete"               "missing interpretation"
    #> [421] "complete"               "missing protocol"       "complete"
    #> [424] "complete"               "complete"               "complete"
    #> [427] "complete"               "complete"               "complete"
    #> [430] "complete"               "missing protocol"       "complete"
    #> [433] "complete"               "missing interpretation" "complete"
    #> [436] "complete"               "complete"               "complete"
    #> [439] "complete"               "complete"               "missing protocol"
    #> [442] "incomplete"             "missing protocol"       "complete"
    #> [445] "missing protocol"       "complete"               "complete"
    #> [448] "complete"               "complete"               "incomplete"
    #> [451] "missing protocol"       "missing protocol"       "missing interpretation"
    #> [454] "complete"               "missing protocol"       "complete"
    #> [457] "complete"               "complete"               "complete"
    #> [460] "complete"               "missing interpretation" "missing protocol"
    #> [463] "complete"               "complete"               "missing interpretation"
    #> [466] "complete"               "complete"               "missing interpretation"
    #> [469] "incomplete"             "missing interpretation" "complete"
    #> [472] "complete"               "missing interpretation" "incomplete"
    #> [475] "complete"               "complete"               "missing interpretation"
    #> [478] "complete"               "complete"               "complete"
    #> [481] "missing interpretation" "complete"               "incomplete"
    #> [484] "missing interpretation" "complete"               "incomplete"
    #> [487] "complete"               "missing interpretation" "missing protocol"
    #> [490] "missing protocol"       "complete"               "complete"
    #> [493] "complete"               "missing protocol"       "complete"
    #> [496] "incomplete"             "missing interpretation" "missing interpretation"
    #> [499] "complete"               "missing protocol"

### Daily behaviour functions

As illustrated in the CAPL-2 manual on page 43, the formula for computing the daily behaviour score is:

#### Step average

The `get_step_average()` function computes the daily arithmetic mean of a week of steps taken as measured by a pedometer. This variable is used to compute the step score.

    step_df <- get_step_average(capl_demo_data)

The `get_step_average()` function returns a data frame with nine columns: `steps1` (validated), `steps2` (validated), `steps3` (validated), `steps4` (validated), `steps5` (validated), `steps6` (validated), `steps7` (validated), `valid_days` and `step_average`.

    str(step_df)
    #> 'data.frame':    500 obs. of  9 variables:
    #>  $ day1        : num  NA NA 8457 8769 14169 ...
    #>  $ day2        : num  14905 24750 NA 21077 15786 ...
    #>  $ day3        : num  21972 NA 14130 NA 18022 ...
    #>  $ day4        : num  28084 27369 14315 NA 6993 ...
    #>  $ day5        : num  14858 21112 16880 11707 20917 ...
    #>  $ day6        : num  17705 NA NA 12235 27766 ...
    #>  $ day7        : num  11067 13540 12106 18795 15039 ...
    #>  $ valid_days  : int  6 4 5 5 7 6 7 7 6 6 ...
    #>  $ step_average: num  18098 21693 13178 14517 16956 ...

    # Add the step average to the dataset
    capl_demo_data$step_average <- step_df$step_average

    capl_demo_data$step_average
    #>   [1] 18098 21693 13178 14517 16956 15255 16964 11217 15484 16110 20592  9690
    #>  [13] 13268 13716  8191 17137 17574 15004 17104 14797 14610 24677 16391 15780
    #>  [25] 16702 18576 14723 16389 16886 15383 16193 16330 12529 15559 13823 16122
    #>  [37] 19027 20663 21974 16912 13020 20361 16285 21868 15697 11545 10465 17299
    #>  [49] 14989  9863 19244 22727 17715 13539 16811 19710 10736 16569 19995 13647
    #>  [61] 18848 13814 10218 21350 14978 15590  6361 14599 22695 12641 17406 10669
    #>  [73] 15582 13489 13568 15639 13953  7900 19802 14654 20254 18182 13025 14514
    #>  [85] 10707 25060 20010 21873 11736 18536 14424 13681 14932 18933 20833 19984
    #>  [97] 18067 16457 21822 19952 17070 15288 16932 19190 16497 10412  9214 21416
    #> [109]    NA 16792 21003  8517 24588 20734 13038 10231 17390 14517 11564 12506
    #> [121] 18186 20292 17081 13962 13002 15281  9442 16720 10978 11025 12416 17754
    #> [133] 17656 10830 16926 20410 14165 13581 15660 10031 12806 20440 13859 12895
    #> [145] 13131  9794 14935 18777 16560 21703 15542 12448 15735 12854 15492 16158
    #> [157] 20797 16280 10846 13008 12519 21301 19390 12013 19271 11710 20024 15647
    #> [169] 13470 15133 15455  6679 15250 11733 21197 17131 15377 16228 15514 17054
    #> [181] 11054 14622 18215 22245 15154 19286 17874 19452 15051 15455 16223 10900
    #> [193] 15504 10904 15651 15672 17107 13278 16124 11700 10986 12394  5526 17145
    #> [205] 15458 21334 16975 13980 22788 13218 17619 15488 18055 17709 11221 20540
    #> [217] 15558 14409 22929 15188 11765 16214 11653 20103 19882 24944 13224 10434
    #> [229] 13530 19901 13603 23764 14626 19212 18186 15367 14699 12987 12979 17466
    #> [241] 14087 11483 16421 12656 14614 21342 17563 21506 20663 19230  6054  2280
    #> [253] 15275 21944 15956 18803 16381 11282 17272 22902 16621 21538 14090 15144
    #> [265] 14745 13032 19488 13956 16619 14545 15343 11870 19157 14566 12099 14641
    #> [277] 21261 12676 19716 15153 11536 12206 11616 17668 14000 24221 14048 14983
    #> [289] 15818 26126 12244 13075 10264 21508 13663 15535 12026 12761 12248 18646
    #> [301] 15459 13882 14996 17236 16931 15535 14902 16595 15692 14539 17792 10528
    #> [313] 21894 13114 17564 11152 22355 17309 11579 19259 18059 14895 17952 20605
    #> [325] 18228 10123 11284 13554 13303 18500 13068 13104 16568 17231 14496 18329
    #> [337]  9947 20183 14487 11510 11294 16538 12374  9054 11935 17584 22263 21393
    #> [349] 13270 20137 11032 19895  8748 14279 12489 19476 19589 18572 13854 16693
    #> [361] 11491 18314 12170 19404 21197 23778 18640 14086 14594 20747  9159 15035
    #> [373] 10229 17469  9294 20226 13583 12374 10885 15218 16800 16694 16970 14550
    #> [385] 12258 17515 14217 11534 16298 19232 15553 21769 12932 18151 20086  9918
    #> [397] 21949 15640 14784 19257 13335 18618 17632 18024 18093 13893 18123 16063
    #> [409] 23877 11390 17165 22555 13149 14000 14632 15251 13901 13374 13730 16041
    #> [421] 16543 17495  9958 14111  9894 22753  8383 13447 20485 24139 12936 18992
    #> [433] 16957 14689 21986 17339 12221 16741 21873 19108 18786 19947  6965 15939
    #> [445] 15646 16810 17381 18823 21679 11727 14030 14564 22617 17374  9160 17795
    #> [457] 18040 17581 21522 18729 18099 23789 18247 13884 14097 10900 10825  8290
    #> [469] 19582 15074 11479 17604 20390 18418 16515 10071 10902 14446 14509 13289
    #> [481] 18030 18891 16851 10817 13964 22037 20584 13780 12073 15555 13787  8145
    #> [493] 12491 19809 13038 10937 17173 16145 14578 21167

There must be at least four valid days of pedometer step counts for an arithmetic mean to be computed. If there are less than four valid days, one of the step values from a valid day will be randomly sampled and used for the fourth valid day before computing the mean. Other important `capl` functions called by the `get_step_average()` function include: `get_pedometer_wear_time()` and `validate_steps()`.

    wear_time1 <- get_pedometer_wear_time(
      time_on = capl_demo_data$time_on1,
      time_off = capl_demo_data$time_off1,
      non_wear_time = capl_demo_data$non_wear_time1
    )

    wear_time1
    #>   [1] 16.37    NA 14.33 15.37 14.12 14.67 17.50 17.83 15.13    NA 13.15 17.42
    #>  [13] 14.88    NA 14.75 14.13 17.68 13.30 15.38 13.07 16.67 13.88 15.32 17.53
    #>  [25] 15.00 14.67    NA 16.35    NA 13.68 15.45 15.65 14.85    NA 16.67    NA
    #>  [37] 17.80 16.90 16.85 13.78 15.03 12.85 14.25 11.37 14.52 16.33 16.67 16.33
    #>  [49] 15.08 15.83 13.90 17.23 11.72    NA 15.80 16.48 12.97 13.22 13.37 13.92
    #>  [61] 14.32 17.62 16.62 11.60 13.12 18.40 14.20    NA 12.12 15.93 14.75 14.23
    #>  [73] 17.40 12.92 14.63 17.65 14.48 14.25    NA 16.42 17.03 14.58 15.33 16.82
    #>  [85] 12.95 14.45 16.77    NA 12.15 17.43    NA 16.97 18.52    NA 17.42 15.60
    #>  [97] 17.65 13.80    NA 13.63 13.83 11.72 16.85 12.80 14.77 16.88 14.93 16.60
    #> [109]    NA 14.38 16.12 15.15 12.60 16.98 13.72 12.50 14.80 13.23 16.27    NA
    #> [121] 14.88 12.07    NA 15.67 14.38 18.03 14.98    NA    NA    NA    NA 14.70
    #> [133] 13.38 13.57 17.57    NA 14.62 15.75 15.50 12.35 14.82 13.53 15.78 12.68
    #> [145] 14.95 15.60 15.73 13.82    NA    NA 18.05 16.48 13.37 11.93    NA 13.67
    #> [157] 13.98 14.73    NA 13.88 13.10 14.03 17.20 13.97 15.43 17.90    NA 13.25
    #> [169] 15.82 11.52 14.62 14.43 15.33 12.88 14.02 16.43 15.85 14.37 13.20 15.48
    #> [181] 17.72 13.87 14.57 15.15 16.58 11.85    NA 15.72    NA 11.60 16.22 17.57
    #> [193] 15.50 17.75 15.32 16.37 11.05 16.40 15.63 14.50    NA    NA    NA 15.25
    #> [205]    NA 17.03 15.15 14.87 15.03 15.58 17.18 15.73 12.63 11.20 17.53 16.60
    #> [217] 18.72 15.95 14.08    NA 17.73 14.37    NA 12.77 14.80 13.78 16.18 16.10
    #> [229] 11.00    NA 16.48    NA 15.83 14.18 13.43 14.17 15.78    NA 14.28 18.58
    #> [241] 17.18    NA    NA 15.50 15.15 17.73 13.43 15.07    NA 14.60 13.42    NA
    #> [253] 13.33    NA 13.50 13.13 14.95 14.52    NA    NA 11.98    NA 12.87 12.87
    #> [265] 14.88 15.83    NA 13.90    NA 16.32 13.33 11.70 15.10 16.12 12.23    NA
    #> [277] 16.30 14.52 16.98 12.57 14.53 14.35 16.87    NA    NA    NA 13.85    NA
    #> [289]    NA 14.98 14.12 16.23 13.80 16.85 16.70 14.40 14.28 15.73 13.00    NA
    #> [301] 17.08 16.78 11.98 16.72    NA 12.08 16.02 14.35 16.63 15.83 16.40 15.57
    #> [313]    NA 11.22 14.68 14.55 13.68    NA 16.78 15.90 15.50 14.38 16.48 15.33
    #> [325] 14.80    NA 14.60 14.50    NA 17.48 12.62 16.80 14.27 13.48 14.77 16.48
    #> [337] 11.30 17.17    NA 16.92 15.98 15.75 12.73 15.97 14.23 13.87 14.08 14.63
    #> [349] 12.32    NA 17.48 16.18 15.20    NA 15.38 17.57 13.52 15.20 16.35 17.00
    #> [361] 14.33 16.78    NA    NA    NA 15.77 12.68 16.65 14.23    NA 18.70 17.55
    #> [373]    NA 17.08    NA 16.82 13.53 12.95 16.58 15.92    NA 14.65 12.93 16.67
    #> [385]    NA 12.92    NA 13.28 12.17 17.73 14.87 17.62 16.97 15.18 14.02 16.58
    #> [397] 12.98 14.98 12.38    NA 12.53 15.05 12.85 12.68 18.63    NA    NA 14.55
    #> [409]    NA 13.07 12.93 11.20    NA 17.72 16.55 13.75 17.17 16.50    NA 14.92
    #> [421] 14.77 15.90 11.30 12.18 17.85    NA    NA    NA 15.92 14.42 16.80 15.10
    #> [433] 12.40 15.55 14.67 14.52 12.18 14.17    NA 16.95 15.73    NA 17.12 11.12
    #> [445]    NA    NA 12.38 13.60 17.98 16.13 12.97    NA    NA    NA 11.87 17.23
    #> [457]    NA    NA 13.72    NA 15.18 11.52 15.80 15.43 18.13    NA 15.57 15.47
    #> [469] 16.27    NA    NA 16.00    NA 12.88 15.53 14.67 12.35 17.17 12.88    NA
    #> [481] 15.72 17.53 17.30 12.12    NA 13.93 16.88 16.00 16.78    NA 17.48    NA
    #> [493]    NA 14.40 17.60    NA 15.53 14.42 16.65 15.70

    valid_steps1 <- validate_steps(
      steps = capl_demo_data$steps1,
      wear_time = wear_time1
    )

    valid_steps1
    #>   [1]    NA    NA  8457  8769 14169  9610 29459 17112    NA    NA 17248  3355
    #>  [13] 24598    NA  4461  6802 22886 11359  4443 16024 29259 27647 16084 12621
    #>  [25] 12268  7801    NA 27912    NA  5187 28325  5421  2613    NA  3454    NA
    #>  [37] 18392 18727    NA 14350 19843 28909  4376 25920 29033 12001 17053 28658
    #>  [49]  2654  3741  9344 14136 24615    NA 23746 18382 16108  9054 10055 27796
    #>  [61] 17747  1763 12925 22616 15816 27087  7309    NA 17448 24552 20614 22613
    #>  [73]  9529 16273 23094 18946  4248 14276    NA  8050 27450 26960 23030  9955
    #>  [85] 10805 23610 11304    NA 23266 23257    NA 11618 25138    NA 20026  6435
    #>  [97] 12730 21297    NA 21832 11803 29608  9771 29072 24700 10064 20255  2574
    #> [109]    NA  8968 25059 16861 17717  2933  8631 10052 25598 22404  5771    NA
    #> [121] 19275 12241    NA  9876 12956 14995 15330    NA    NA    NA    NA 29222
    #> [133] 25634  2212 22617    NA 11412 15123 15144  5547    NA 19113 13972  7991
    #> [145]    NA 10375  1487  4610    NA    NA 24894 28248 10492 27681    NA 26918
    #> [157] 22202 19509    NA  4831 21458 22153  1277  9399 12211  1709    NA 15369
    #> [169]  4175 16306 27112  4078 20565 24711 16097    NA  2416 24568  3387 22382
    #> [181]  2571  8689 27157 23069  9768 24245    NA 14105    NA 18393 27233  2433
    #> [193] 25977 13148 23821 17737  9255  4616    NA 12644    NA    NA    NA 11922
    #> [205]    NA 24112 22514 17337 28116 11817 24501 11422 27920 29562 15346 18906
    #> [217] 24028  6226 19006    NA  8578  2110    NA 26168 20885 29012 12072  4059
    #> [229] 10583    NA 14613    NA  2518  8609 18923 29152  1335    NA  6236 21048
    #> [241] 14819    NA    NA 20525  1524 26867 29430 29949    NA 24522  1407    NA
    #> [253]  3091    NA 15889 20661 20235 11786    NA    NA 17704    NA  5859 16473
    #> [265] 19092 16722    NA  1025    NA 11434  1645  8725 10888 19349  2579    NA
    #> [277] 29827 23035  2570  4377 12958 13633  7419    NA    NA    NA  6789    NA
    #> [289]    NA 25115  9296  9582  3111  5645 12385    NA 18477 15522 19293    NA
    #> [301] 24930    NA 23988 10699    NA 17989  4296  9965 24623  9071 13743 11185
    #> [313]    NA 13911 27755 13981 21713    NA  1790 23566 11741 12946  1162 11789
    #> [325]  7385    NA 25919 11325    NA 23274  6820 16954 26854 13293 11647 25737
    #> [337]  1360  2619    NA 19230  5023  6494 26222  8219 24639    NA 22748    NA
    #> [349]  8809    NA  8962 18175  3237    NA 14791 23667  7614 29533  3897 22083
    #> [361]  5798 12271    NA    NA    NA 25454 26928  7478 17362    NA 15231 12015
    #> [373]    NA 23843    NA 21514 14268 14929 12130 18649    NA 20391 17395    NA
    #> [385]    NA 19777    NA 22014  7361 16064 11599 10858 13855 24319 27075  3224
    #> [397] 18233 17462  2574    NA 13808 18686 27388 29431  4089    NA    NA 15614
    #> [409]    NA  4991 12633 22834    NA  8554 22825 18769 18711 12104    NA 20605
    #> [421] 24985  6319  7926 12298  1281    NA    NA    NA 19007 24157 19259 11413
    #> [433] 22736 29065 17238 25556 18052 27474    NA 16903 10419    NA  1678 20988
    #> [445]    NA    NA 10910 29527 24740 26121 14034    NA    NA    NA  6455 14804
    #> [457]    NA    NA 29519    NA 24277 22596 11441 23665  7938    NA    NA  4701
    #> [469] 23842    NA    NA  3756    NA  9932  2995  3342  1541 25320 28031    NA
    #> [481]  3022 26496 18121 16197    NA 27060 28411 26595 26752    NA 10457    NA
    #> [493]    NA 27567 27648    NA 17103  5439 22349 28614

#### Step score

The `get_step_score()` function computes a step score that ranges from zero to 25 based on the average daily steps taken as measured by a pedometer. This score is used to compute the daily behaviour domain score.

    capl_demo_data$step_score <- get_step_score(capl_demo_data$step_average)

    capl_demo_data$step_score
    #>   [1] 25 25 19 21 23 22 23 15 22 23 25 12 19 20  9 24 24 22 24 21 21 25 23 22 23
    #>  [26] 25 21 23 23 22 23 23 18 22 20 23 25 25 25 23 19 25 23 25 22 16 13 24 21 12
    #>  [51] 25 25 24 20 23 25 14 23 25 20 25 20 13 25 21 22  5 21 25 18 24 14 22 19 20
    #>  [76] 22 20  8 25 21 25 25 19 21 14 25 25 25 16 25 21 20 21 25 25 25 25 23 25 25
    #> [101] 24 22 23 25 23 13 11 25 NA 23 25 10 25 25 19 13 24 21 16 18 25 25 24 20 19
    #> [126] 22 11 23 14 15 17 24 24 14 23 25 21 20 22 13 18 25 20 18 19 12 21 25 23 25
    #> [151] 22 17 22 18 22 23 25 23 14 19 18 25 25 17 25 16 25 22 19 22 22  6 22 16 25
    #> [176] 24 22 23 22 24 15 21 25 25 22 25 24 25 22 22 23 14 22 14 22 22 24 19 23 16
    #> [201] 14 17  4 24 22 25 23 20 25 19 24 22 25 24 15 25 22 21 25 22 16 23 16 25 25
    #> [226] 25 19 13 20 25 20 25 21 25 25 22 21 18 18 24 21 15 23 18 21 25 24 25 25 25
    #> [251]  5  1 22 25 22 25 23 15 24 25 23 25 21 22 21 19 25 20 23 21 22 16 25 21 17
    #> [276] 21 25 18 25 22 16 17 16 24 21 25 21 21 22 25 17 19 13 25 20 22 17 18 17 25
    #> [301] 22 20 21 24 23 22 21 23 22 21 24 14 25 19 24 15 25 24 16 25 25 21 24 25 25
    #> [326] 13 15 20 19 25 19 19 23 24 21 25 12 25 21 16 15 23 17 11 16 24 25 25 19 25
    #> [351] 15 25 10 21 17 25 25 25 20 23 15 25 17 25 25 25 25 21 21 25 11 22 13 24 11
    #> [376] 25 20 17 14 22 23 23 23 21 17 24 21 16 23 25 22 25 18 25 25 12 25 22 21 25
    #> [401] 19 25 24 25 25 20 25 23 25 15 24 25 19 21 21 22 20 19 20 23 23 24 12 21 12
    #> [426] 25  9 19 25 25 18 25 23 21 25 24 17 23 25 25 25 25  6 22 22 23 24 25 25 16
    #> [451] 21 21 25 24 11 24 25 24 25 25 25 25 25 20 21 14 14  9 25 22 15 24 25 25 23
    #> [476] 13 14 21 21 19 25 25 23 14 20 25 25 20 17 22 20  9 17 25 19 14 24 23 21 25

#### Self-reported physical activity score

The `get_self_report_pa()` function computes a score that ranges from zero to five based on the response to “During the past week (7 days), on how many days were you physically active for a total of at least 60 minutes per day (all the time you spent in activities that increased your heart rate and made you breathe hard)?” in the CAPL-2 Questionnaire. This score is used to compute the daily behaviour domain score.

    capl_demo_data$self_report_pa_score <- get_self_report_pa_score(capl_demo_data$self_report_pa)

    capl_demo_data$self_report_pa_score
    #>   [1] NA  1  1  3  2  4 NA  5  5  5 NA  3  1  4  5  5  0  5  5  5  5  5  5 NA  5
    #>  [26]  3  4  5  4  1  2  0  5  5  5  5  4  3  4  2  4  5  5  5  2  5  5 NA  5  5
    #>  [51]  1  5  3  1  0  5  3  2  5  1  2  0  5 NA  3  5  4  0  3 NA  5  4  1 NA  0
    #>  [76]  5  0  2  0 NA  5  5  1  1  3  3  5  2  5  4  5  5  4  3  1  4  2  1  5  5
    #> [101]  5  2  1  4  3  2  5  5  3  2  2  5  5  5  2 NA  5  1  5  5 NA  5  5  1  0
    #> [126]  4  5  4  0  0  5  4  5  0  5  5  5  5  2  5  5  5  2  5  1  3  5  5 NA  5
    #> [151]  5  0  2  1  0  5  3  3  2  0  5  1  5  4  0  3  5  5  3  5  5  5  0  5  4
    #> [176] NA  5  5  4  5  3  4  3  0  2  1  5  3  0  5  1  5  5  5  5  0  2  3  0  1
    #> [201]  0  1  5  5  5  2  5  3  4  2  5  5  5  5  2  5  5  1  0  1  5  4  1  5  3
    #> [226]  4  3  5  0  5  2  5  0 NA  5  3  3 NA  2  0  4  5  5  5  5  4  0  3  3  2
    #> [251]  4  5  5  5  5  3  0  4  5  1  5  0  0  5  1  1  1  3  4  0  3  2  4  0  4
    #> [276]  5  0  5  3  2  3  3  5  5  3  5  4  3  3  0  4 NA  5  2  5  3  5  5  1  2
    #> [301]  5  5  2  5  5 NA  5  5 NA  5  5  4  1  5  3  5  0  5  0  3  2  0  3  0  0
    #> [326]  3  1  4  5  5  1  5  5  5  5  1  3  0  1  5  4  5  3  0  3  0  4  1 NA  2
    #> [351]  1  0  5  5  5  1  1  3  2  2  5  4  0  3  5  5  3  5  5  5  5  5  1  5  5
    #> [376]  5  2 NA  4  0  5  1  2  5  5  5  5  2  1  5  0  5  2  5  5  5  0 NA  5  5
    #> [401]  0  4  5  5  3  0  4  1  5 NA  2 NA  1  1  3  5  5  2  3  5  5  5  4  0  0
    #> [426]  5  4  4  5  3  5 NA  0  1  5  2  4  1  5  4  5  0  3  5 NA  4  3  4  4  4
    #> [451]  0  3 NA  5  5  3  1  5  5  5  5  1  3  2  5  0  5  1  0  2  0  2  5  5  3
    #> [476]  1  5  5  1  2  4  5  4  5  3  1  2  5  5  2  1  5  5  3  5  5 NA  0  2 NA

#### Daily behaviour score

The `get_db_score()` function computes a daily behaviour domain score that ranges from zero to 30 based on the step and self-reported physical activity scores. This score is used to compute the overall physical literacy score.

    capl_demo_data$db_score <- get_db_score(
      step_score = capl_demo_data$step_score,
      self_report_pa_score = capl_demo_data$self_report_pa_score
    )

    capl_demo_data$db_score
    #>   [1] NA 26 20 24 25 26 NA 20 27 28 NA 15 20 24 14 29 24 27 29 26 26 30 28 NA 28
    #>  [26] 28 25 28 27 23 25 23 23 27 25 28 29 28 29 25 23 30 28 30 24 21 18 NA 26 17
    #>  [51] 26 30 27 21 23 30 17 25 30 21 27 20 18 NA 24 27  9 21 28 NA 29 18 23 NA 20
    #>  [76] 27 20 10 25 NA 30 30 20 22 17 28 30 27 21 29 26 25 25 28 26 29 27 24 30 30
    #> [101] 29 24 24 29 26 15 16 30 NA 25 27 15 30 30 21 NA 29 22 21 23 NA 30 29 21 19
    #> [126] 26 16 27 14 15 22 28 29 14 28 30 26 25 24 18 23 30 22 23 20 15 26 30 NA 30
    #> [151] 27 17 24 19 22 28 28 26 16 19 23 26 30 21 25 19 30 27 22 27 27 11 22 21 29
    #> [176] NA 27 28 26 29 18 25 28 25 24 26 29 28 22 27 24 19 27 19 27 22 26 22 23 17
    #> [201] 14 18  9 29 27 27 28 23 29 21 29 27 30 29 17 30 27 22 25 23 21 27 17 30 28
    #> [226] 29 22 18 20 30 22 30 21 NA 30 25 24 NA 20 24 25 20 28 23 26 29 24 28 28 27
    #> [251]  9  6 27 30 27 28 23 19 29 26 28 25 21 27 22 20 26 23 27 21 25 18 29 21 21
    #> [276] 26 25 23 28 24 19 20 21 29 24 30 25 24 25 25 21 NA 18 27 25 25 22 23 18 27
    #> [301] 27 25 23 29 28 NA 26 28 NA 26 29 18 26 24 27 20 25 29 16 28 27 21 27 25 25
    #> [326] 16 16 24 24 30 20 24 28 29 26 26 15 25 22 21 19 28 20 11 19 24 29 26 NA 27
    #> [351] 16 25 15 26 22 26 26 28 22 25 20 29 17 28 30 30 28 26 26 30 16 27 14 29 16
    #> [376] 30 22 NA 18 22 28 24 25 26 22 29 26 18 24 30 22 30 20 30 30 17 25 NA 26 30
    #> [401] 19 29 29 30 28 20 29 24 30 NA 26 NA 20 22 24 27 25 21 23 28 28 29 16 21 12
    #> [426] 30 13 23 30 28 23 NA 23 22 30 26 21 24 30 29 30 25  9 27 NA 27 27 29 29 20
    #> [451] 21 24 NA 29 16 27 26 29 30 30 30 26 28 22 26 14 19 10 25 24 15 26 30 30 26
    #> [476] 14 19 26 22 21 29 30 27 19 23 26 27 25 22 24 21 14 22 28 24 19 NA 23 23 NA

#### Daily behaviour interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$db_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$db_score,
      protocol = "db"
    )

    capl_demo_data$db_interpretation
    #>   [1] NA            "achieving"   "progressing" "achieving"   "achieving"
    #>   [6] "achieving"   NA            "progressing" "excelling"   "excelling"
    #>  [11] NA            "progressing" NA            NA            "progressing"
    #>  [16] "excelling"   "achieving"   "excelling"   "excelling"   "excelling"
    #>  [21] "achieving"   "excelling"   "excelling"   NA            NA
    #>  [26] NA            "excelling"   NA            "excelling"   "achieving"
    #>  [31] "achieving"   "achieving"   "achieving"   NA            "excelling"
    #>  [36] NA            NA            "excelling"   "excelling"   "achieving"
    #>  [41] "achieving"   "excelling"   "excelling"   "excelling"   "achieving"
    #>  [46] "progressing" "progressing" NA            NA            NA
    #>  [51] "achieving"   "excelling"   "excelling"   "progressing" "achieving"
    #>  [56] "excelling"   "progressing" "achieving"   "excelling"   "achieving"
    #>  [61] "excelling"   NA            "progressing" NA            "achieving"
    #>  [66] NA            "progressing" "progressing" NA            NA
    #>  [71] "excelling"   "progressing" "achieving"   NA            NA
    #>  [76] "excelling"   NA            "beginning"   "achieving"   NA
    #>  [81] NA            "excelling"   "progressing" "progressing" "progressing"
    #>  [86] NA            "excelling"   "excelling"   "progressing" "excelling"
    #>  [91] "achieving"   "achieving"   NA            NA            NA
    #>  [96] "excelling"   NA            "achieving"   "excelling"   "excelling"
    #> [101] "excelling"   "achieving"   "achieving"   NA            "achieving"
    #> [106] "progressing" "progressing" "excelling"   NA            "achieving"
    #> [111] "excelling"   "progressing" "excelling"   NA            "progressing"
    #> [116] NA            "excelling"   "progressing" "progressing" "achieving"
    #> [121] NA            "excelling"   "excelling"   "progressing" "progressing"
    #> [126] NA            "progressing" NA            NA            "progressing"
    #> [131] "progressing" NA            "excelling"   "progressing" "excelling"
    #> [136] "excelling"   "achieving"   "achieving"   "achieving"   "progressing"
    #> [141] "achieving"   "excelling"   "progressing" "achieving"   "progressing"
    #> [146] "progressing" NA            NA            NA            "excelling"
    #> [151] "excelling"   "progressing" "achieving"   "progressing" "achieving"
    #> [156] "excelling"   "excelling"   "excelling"   "progressing" "progressing"
    #> [161] NA            "achieving"   "excelling"   "progressing" NA
    #> [166] "progressing" "excelling"   NA            "progressing" "excelling"
    #> [171] "excelling"   "progressing" "progressing" "achieving"   "excelling"
    #> [176] NA            "excelling"   NA            NA            "excelling"
    #> [181] "progressing" NA            "excelling"   NA            "achieving"
    #> [186] "achieving"   "excelling"   "excelling"   "achieving"   NA
    #> [191] "achieving"   "progressing" "excelling"   "progressing" NA
    #> [196] "achieving"   "achieving"   "progressing" "achieving"   NA
    #> [201] "progressing" "progressing" "progressing" "excelling"   "excelling"
    #> [206] "excelling"   "excelling"   "achieving"   "excelling"   NA
    #> [211] NA            "excelling"   "excelling"   "excelling"   "progressing"
    #> [216] "excelling"   NA            "achieving"   "achieving"   "achieving"
    #> [221] "achieving"   "excelling"   NA            NA            "excelling"
    #> [226] "excelling"   "achieving"   NA            "progressing" NA
    #> [231] "progressing" "excelling"   "progressing" NA            "excelling"
    #> [236] "achieving"   "achieving"   NA            "progressing" "achieving"
    #> [241] "achieving"   "progressing" NA            NA            NA
    #> [246] "excelling"   "achieving"   NA            NA            "excelling"
    #> [251] NA            "beginning"   NA            "excelling"   "excelling"
    #> [256] "excelling"   "achieving"   "progressing" "excelling"   NA
    #> [261] "excelling"   "achieving"   "achieving"   "excelling"   "achieving"
    #> [266] "progressing" "achieving"   "achieving"   "excelling"   "progressing"
    #> [271] "achieving"   "progressing" NA            "achieving"   "achieving"
    #> [276] "achieving"   "achieving"   "achieving"   "excelling"   "achieving"
    #> [281] "progressing" NA            "achieving"   "excelling"   "achieving"
    #> [286] "excelling"   "achieving"   "achieving"   "excelling"   "excelling"
    #> [291] "achieving"   NA            "progressing" "excelling"   NA
    #> [296] "achieving"   "achieving"   "achieving"   "progressing" "excelling"
    #> [301] "excelling"   "achieving"   "achieving"   "excelling"   "excelling"
    #> [306] NA            "achieving"   NA            NA            "achieving"
    #> [311] "excelling"   "progressing" "excelling"   "achieving"   "excelling"
    #> [316] "progressing" "excelling"   "excelling"   "progressing" NA
    #> [321] "excelling"   "progressing" "excelling"   "achieving"   "achieving"
    #> [326] NA            "progressing" "achieving"   "achieving"   "excelling"
    #> [331] "progressing" "achieving"   "excelling"   "excelling"   "achieving"
    #> [336] "excelling"   "progressing" "achieving"   "achieving"   "progressing"
    #> [341] NA            NA            "progressing" "progressing" "progressing"
    #> [346] "achieving"   "excelling"   "excelling"   NA            "excelling"
    #> [351] NA            NA            "progressing" "achieving"   "progressing"
    #> [356] "excelling"   NA            "excelling"   "achieving"   "achieving"
    #> [361] NA            "excelling"   NA            "excelling"   "excelling"
    #> [366] "excelling"   "excelling"   "achieving"   "achieving"   "excelling"
    #> [371] "progressing" "excelling"   "progressing" NA            "progressing"
    #> [376] "excelling"   "achieving"   NA            NA            "progressing"
    #> [381] "excelling"   "achieving"   "achieving"   "achieving"   "achieving"
    #> [386] "excelling"   "achieving"   NA            "achieving"   "excelling"
    #> [391] "achieving"   "excelling"   NA            "excelling"   "excelling"
    #> [396] "progressing" "achieving"   NA            "achieving"   "excelling"
    #> [401] NA            "excelling"   "excelling"   "excelling"   "excelling"
    #> [406] "progressing" NA            "achieving"   "excelling"   NA
    #> [411] NA            NA            "progressing" "progressing" "achieving"
    #> [416] "excelling"   "achieving"   "progressing" "achieving"   NA
    #> [421] "excelling"   "excelling"   "progressing" "progressing" "progressing"
    #> [426] "excelling"   "progressing" "achieving"   "excelling"   "excelling"
    #> [431] "achieving"   NA            "achieving"   NA            "excelling"
    #> [436] "achieving"   "progressing" "achieving"   "excelling"   "excelling"
    #> [441] "excelling"   "achieving"   "beginning"   "excelling"   NA
    #> [446] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [451] "progressing" "achieving"   NA            "excelling"   "progressing"
    #> [456] "excelling"   "excelling"   "excelling"   "excelling"   "excelling"
    #> [461] NA            "achieving"   "excelling"   "progressing" NA
    #> [466] "progressing" "progressing" NA            NA            NA
    #> [471] "progressing" "excelling"   NA            "excelling"   "achieving"
    #> [476] "progressing" NA            "achieving"   "progressing" "progressing"
    #> [481] NA            "excelling"   "excelling"   NA            "achieving"
    #> [486] NA            "excelling"   NA            "progressing" "achieving"
    #> [491] "progressing" "progressing" "progressing" "excelling"   "achieving"
    #> [496] "progressing" NA            NA            "achieving"   NA

#### Daily behaviour domain status

The `get_capl_domain_status()` function computes the status (“complete”, “missing interpretation”, “missing protocol” or “incomplete”) of a CAPL domain.

    capl_demo_data$db_status <- get_capl_domain_status(
      x = capl_demo_data,
      domain = "db"
    )

    capl_demo_data$db_status
    #>   [1] "incomplete"             "complete"               "complete"
    #>   [4] "complete"               "complete"               "complete"
    #>   [7] "incomplete"             "complete"               "complete"
    #>  [10] "complete"               "incomplete"             "complete"
    #>  [13] "missing interpretation" "missing interpretation" "complete"
    #>  [16] "complete"               "complete"               "complete"
    #>  [19] "complete"               "complete"               "complete"
    #>  [22] "complete"               "complete"               "incomplete"
    #>  [25] "missing interpretation" "missing interpretation" "complete"
    #>  [28] "missing interpretation" "complete"               "complete"
    #>  [31] "complete"               "complete"               "complete"
    #>  [34] "missing interpretation" "complete"               "missing interpretation"
    #>  [37] "missing interpretation" "complete"               "complete"
    #>  [40] "complete"               "complete"               "complete"
    #>  [43] "complete"               "complete"               "complete"
    #>  [46] "complete"               "complete"               "incomplete"
    #>  [49] "missing interpretation" "missing interpretation" "complete"
    #>  [52] "complete"               "complete"               "complete"
    #>  [55] "complete"               "complete"               "complete"
    #>  [58] "complete"               "complete"               "complete"
    #>  [61] "complete"               "missing interpretation" "complete"
    #>  [64] "incomplete"             "complete"               "missing interpretation"
    #>  [67] "complete"               "complete"               "missing interpretation"
    #>  [70] "incomplete"             "complete"               "complete"
    #>  [73] "complete"               "incomplete"             "missing interpretation"
    #>  [76] "complete"               "missing interpretation" "complete"
    #>  [79] "complete"               "incomplete"             "missing interpretation"
    #>  [82] "complete"               "complete"               "complete"
    #>  [85] "complete"               "missing interpretation" "complete"
    #>  [88] "complete"               "complete"               "complete"
    #>  [91] "complete"               "complete"               "missing interpretation"
    #>  [94] "missing interpretation" "missing interpretation" "complete"
    #>  [97] "missing interpretation" "complete"               "complete"
    #> [100] "complete"               "complete"               "complete"
    #> [103] "complete"               "missing interpretation" "complete"
    #> [106] "complete"               "complete"               "complete"
    #> [109] "incomplete"             "complete"               "complete"
    #> [112] "complete"               "complete"               "missing interpretation"
    #> [115] "complete"               "incomplete"             "complete"
    #> [118] "complete"               "complete"               "complete"
    #> [121] "incomplete"             "complete"               "complete"
    #> [124] "complete"               "complete"               "missing interpretation"
    #> [127] "complete"               "missing interpretation" "missing interpretation"
    #> [130] "complete"               "complete"               "missing interpretation"
    #> [133] "complete"               "complete"               "complete"
    #> [136] "complete"               "complete"               "complete"
    #> [139] "complete"               "complete"               "complete"
    #> [142] "complete"               "complete"               "complete"
    #> [145] "complete"               "complete"               "missing interpretation"
    #> [148] "missing interpretation" "incomplete"             "complete"
    #> [151] "complete"               "complete"               "complete"
    #> [154] "complete"               "complete"               "complete"
    #> [157] "complete"               "complete"               "complete"
    #> [160] "complete"               "missing interpretation" "complete"
    #> [163] "complete"               "complete"               "missing interpretation"
    #> [166] "complete"               "complete"               "missing interpretation"
    #> [169] "complete"               "complete"               "complete"
    #> [172] "complete"               "complete"               "complete"
    #> [175] "complete"               "incomplete"             "complete"
    #> [178] "missing interpretation" "missing interpretation" "complete"
    #> [181] "complete"               "missing interpretation" "complete"
    #> [184] "missing interpretation" "complete"               "complete"
    #> [187] "complete"               "complete"               "complete"
    #> [190] "missing interpretation" "complete"               "complete"
    #> [193] "complete"               "complete"               "missing interpretation"
    #> [196] "complete"               "complete"               "complete"
    #> [199] "complete"               "missing interpretation" "complete"
    #> [202] "complete"               "complete"               "complete"
    #> [205] "complete"               "complete"               "complete"
    #> [208] "complete"               "complete"               "missing interpretation"
    #> [211] "missing interpretation" "complete"               "complete"
    #> [214] "complete"               "complete"               "complete"
    #> [217] "missing interpretation" "complete"               "complete"
    #> [220] "complete"               "complete"               "complete"
    #> [223] "missing interpretation" "missing interpretation" "complete"
    #> [226] "complete"               "complete"               "missing interpretation"
    #> [229] "complete"               "missing interpretation" "complete"
    #> [232] "complete"               "complete"               "incomplete"
    #> [235] "complete"               "complete"               "complete"
    #> [238] "incomplete"             "complete"               "complete"
    #> [241] "complete"               "complete"               "missing interpretation"
    #> [244] "missing interpretation" "missing interpretation" "complete"
    #> [247] "complete"               "missing interpretation" "missing interpretation"
    #> [250] "complete"               "missing interpretation" "complete"
    #> [253] "missing interpretation" "complete"               "complete"
    #> [256] "complete"               "complete"               "complete"
    #> [259] "complete"               "missing interpretation" "complete"
    #> [262] "complete"               "complete"               "complete"
    #> [265] "complete"               "complete"               "complete"
    #> [268] "complete"               "complete"               "complete"
    #> [271] "complete"               "complete"               "missing interpretation"
    #> [274] "complete"               "complete"               "complete"
    #> [277] "complete"               "complete"               "complete"
    #> [280] "complete"               "complete"               "missing interpretation"
    #> [283] "complete"               "complete"               "complete"
    #> [286] "complete"               "complete"               "complete"
    #> [289] "complete"               "complete"               "complete"
    #> [292] "incomplete"             "complete"               "complete"
    #> [295] "missing interpretation" "complete"               "complete"
    #> [298] "complete"               "complete"               "complete"
    #> [301] "complete"               "complete"               "complete"
    #> [304] "complete"               "complete"               "incomplete"
    #> [307] "complete"               "missing interpretation" "incomplete"
    #> [310] "complete"               "complete"               "complete"
    #> [313] "complete"               "complete"               "complete"
    #> [316] "complete"               "complete"               "complete"
    #> [319] "complete"               "missing interpretation" "complete"
    #> [322] "complete"               "complete"               "complete"
    #> [325] "complete"               "missing interpretation" "complete"
    #> [328] "complete"               "complete"               "complete"
    #> [331] "complete"               "complete"               "complete"
    #> [334] "complete"               "complete"               "complete"
    #> [337] "complete"               "complete"               "complete"
    #> [340] "complete"               "missing interpretation" "missing interpretation"
    #> [343] "complete"               "complete"               "complete"
    #> [346] "complete"               "complete"               "complete"
    #> [349] "incomplete"             "complete"               "missing interpretation"
    #> [352] "missing interpretation" "complete"               "complete"
    #> [355] "complete"               "complete"               "missing interpretation"
    #> [358] "complete"               "complete"               "complete"
    #> [361] "missing interpretation" "complete"               "missing interpretation"
    #> [364] "complete"               "complete"               "complete"
    #> [367] "complete"               "complete"               "complete"
    #> [370] "complete"               "complete"               "complete"
    #> [373] "complete"               "missing interpretation" "complete"
    #> [376] "complete"               "complete"               "incomplete"
    #> [379] "missing interpretation" "complete"               "complete"
    #> [382] "complete"               "complete"               "complete"
    #> [385] "complete"               "complete"               "complete"
    #> [388] "missing interpretation" "complete"               "complete"
    #> [391] "complete"               "complete"               "missing interpretation"
    #> [394] "complete"               "complete"               "complete"
    #> [397] "complete"               "incomplete"             "complete"
    #> [400] "complete"               "missing interpretation" "complete"
    #> [403] "complete"               "complete"               "complete"
    #> [406] "complete"               "missing interpretation" "complete"
    #> [409] "complete"               "incomplete"             "missing interpretation"
    #> [412] "incomplete"             "complete"               "complete"
    #> [415] "complete"               "complete"               "complete"
    #> [418] "complete"               "complete"               "missing interpretation"
    #> [421] "complete"               "complete"               "complete"
    #> [424] "complete"               "complete"               "complete"
    #> [427] "complete"               "complete"               "complete"
    #> [430] "complete"               "complete"               "incomplete"
    #> [433] "complete"               "missing interpretation" "complete"
    #> [436] "complete"               "complete"               "complete"
    #> [439] "complete"               "complete"               "complete"
    #> [442] "complete"               "complete"               "complete"
    #> [445] "incomplete"             "complete"               "complete"
    #> [448] "complete"               "complete"               "missing interpretation"
    #> [451] "complete"               "complete"               "incomplete"
    #> [454] "complete"               "complete"               "complete"
    #> [457] "complete"               "complete"               "complete"
    #> [460] "complete"               "missing interpretation" "complete"
    #> [463] "complete"               "complete"               "missing interpretation"
    #> [466] "complete"               "complete"               "missing interpretation"
    #> [469] "missing interpretation" "missing interpretation" "complete"
    #> [472] "complete"               "missing interpretation" "complete"
    #> [475] "complete"               "complete"               "missing interpretation"
    #> [478] "complete"               "complete"               "complete"
    #> [481] "missing interpretation" "complete"               "complete"
    #> [484] "missing interpretation" "complete"               "missing interpretation"
    #> [487] "complete"               "missing interpretation" "complete"
    #> [490] "complete"               "complete"               "complete"
    #> [493] "complete"               "complete"               "complete"
    #> [496] "complete"               "incomplete"             "missing interpretation"
    #> [499] "complete"               "incomplete"

### Motivation and confidence functions

As illustrated in the CAPL-2 manual on page 79, the formula for computing the motivation and confidence score is:

#### Predilection score

The `get_predilection_score()` function computes a predilection score (`predilection_score`) that ranges from 1.8 to 7.5 based on responses to three items from the Children’s Self-Perceptions of Adequacy in and Predilection for Physical Activity (Hay, 1992) as they appear in the CAPL-2 questionnaire. This score is used to compute the motivation and confidence domain score.

    capl_demo_data$predilection_score <- get_predilection_score(
      csappa1 = capl_demo_data$csappa1,
      csappa3 = capl_demo_data$csappa3,
      csappa5 = capl_demo_data$csappa5
    )

    capl_demo_data$predilection_score
    #>   [1] 3.6 4.9 5.5 3.0  NA 3.0 6.2 4.9 4.8 4.9 3.0 3.0 5.6 4.9 5.5 5.5 4.9 4.3
    #>  [19] 5.6 3.6 4.2 3.6 6.1 3.6 4.3 4.8 5.6 3.0 4.3 4.3 6.1 4.9 6.2 3.6 6.8 5.5
    #>  [37] 5.5 6.2 3.0 2.4 4.3 3.6 5.5 6.1  NA 4.3 2.4 4.9 4.9  NA 5.5 4.3 4.2 4.2
    #>  [55] 4.9 6.2 4.3 5.5 1.8 3.7 4.9 3.7 6.8 4.8 6.2 4.2 3.7 1.8 5.5 3.0 5.5 4.2
    #>  [73] 4.8 5.5 4.9 3.6 4.9 3.7 3.6 3.6 4.9 6.2 4.2 3.7 3.7 3.6 3.0 2.4 4.2 4.2
    #>  [91] 3.0 5.4 5.5 6.2 4.3 3.6 5.6 6.1 4.9  NA 4.2 5.5 6.8 4.8 4.9 4.9 4.9 2.4
    #> [109] 4.8 3.0 3.6 3.6 4.9 3.6 4.3 3.7 2.4 3.0 3.6 4.2 4.3 4.3 6.8 5.6 4.9 6.2
    #> [127] 3.0 3.0 5.5 3.6 4.2 3.7 6.1 3.7 3.6 6.2 6.1 4.8 3.6 4.9 1.8 5.6 3.0 4.9
    #> [145] 4.9 4.8 3.0 4.8 4.2 4.9 2.4 5.5 3.7 4.3 3.6 3.0 4.8 5.5 7.5 4.9 4.8 4.2
    #> [163] 3.0 2.4 5.5 2.4 5.5 6.1 3.6 5.5 4.3 4.2 4.3  NA 6.1 3.6 4.9 5.6 3.7 2.4
    #> [181] 5.6 3.0 4.2 3.7 5.4 6.2 4.2 4.3 3.6 5.5 5.5 3.6 4.9 3.6 4.9 3.7 4.9 4.2
    #> [199] 4.9 4.3 6.2 2.4 4.3 3.6 6.8 4.9 4.9 6.1 2.4 7.5 5.5 4.3 6.2 5.6 4.8 3.0
    #> [217] 5.6 3.6 4.9 6.1 4.3 4.8 4.2 3.6 4.3 6.1 6.8 4.9 3.0 3.6 3.0 5.6 4.9 4.3
    #> [235] 6.2 5.6 1.8  NA 5.5 3.6 4.3 6.2 4.9 4.8 3.6 5.5 4.9 5.5 4.9 6.1 4.9 4.3
    #> [253] 6.8 3.6 4.9 4.2 4.8 5.5 4.2 3.0 6.2 4.8 3.6 4.2 4.3 4.9 7.5 4.3 5.5 4.9
    #> [271] 1.8 3.6 5.5 4.2 5.6 4.2 4.9 3.0 3.7 4.3 4.9 4.8 3.0 3.6 4.9 4.9 6.1 4.9
    #> [289] 4.2 3.6 5.5 5.5 2.4 2.4 3.7 5.5 5.4 6.2 3.7 6.8 4.2 7.5 5.6 3.7 4.2 5.5
    #> [307] 4.3 5.4 4.9 3.6 4.8 4.8 4.2 6.1 4.3 3.0 3.7 6.8 3.6 3.0 6.2 4.8 4.2 5.5
    #> [325] 4.3 4.2 4.9 4.3 3.0 3.0 4.9 4.3 4.3 6.2 6.1 4.3 4.2 5.6 3.6 6.1 4.9 4.3
    #> [343] 7.5 6.2 4.3 3.6 6.2 4.2 4.2 4.3 2.4 3.6 1.8 5.5 5.5 5.5 3.7 7.5 5.5 5.5
    #> [361] 7.5 6.2 3.7 3.6 3.6 2.4 3.0 3.0 4.9 6.1 4.9 5.5 4.3 3.0 4.9 3.6 4.3 4.2
    #> [379] 4.2 3.7 3.0 3.6 4.3 4.3 4.9 3.0 4.9 4.3 4.2 3.6 6.1 4.2 4.9 4.9 5.5 6.8
    #> [397] 5.6 4.9 4.2 3.6 3.6 4.2 4.2 4.3 4.3 6.1 6.1 5.6 3.6 5.5 5.5 3.0 6.1 3.0
    #> [415] 6.2 5.6 4.9 3.0 3.6 4.3 3.6 3.7 6.1 2.4 5.6 4.9 5.5 7.5 5.5 3.7 4.3 6.2
    #> [433] 4.9 4.9 4.2 4.3 3.6 4.2 4.2 3.6 3.0 5.5 2.4 3.6 4.8 6.1 4.2 2.4 3.0 4.9
    #> [451] 3.7 4.9 3.6 5.6 3.6 4.9 4.8 4.2 3.0 6.8 5.5 3.7 3.6 6.2 4.9 3.6 3.6 3.7
    #> [469] 3.0 4.2 3.0 4.3 6.2 6.8 5.4 4.3 4.3  NA 6.1 3.0 4.9 3.0 4.9 6.8 5.5 4.9
    #> [487] 6.1 3.0 4.9 4.2 4.2 4.2 2.4 3.6 4.3 5.5 3.7 6.1 2.4 4.2

#### Adequacy score

The `get_adequacy_score()` function computes an adequacy score that ranges from 1.8 to 7.5 based on responses to three items from the Children’s Self-Perceptions of Adequacy in and Predilection for Physical Activity Questionnaire (Hay, 1992) as they appear in the CAPL-2 questionnaire. This score is used to compute the motivation and confidence domain score.

    capl_demo_data$adequacy_score <- get_adequacy_score(
      csappa2 = capl_demo_data$csappa2,
      csappa4 = capl_demo_data$csappa4,
      csappa6 = capl_demo_data$csappa6
    )

    capl_demo_data$adequacy_score
    #>   [1] 2.4 5.5 7.5 4.3 5.5 5.5 4.2 4.3 3.6 4.3 6.2 4.9 4.9 4.2 4.3 5.6 4.2 4.8
    #>  [19] 4.8 6.2 4.3 4.8 4.9 3.6 6.8 4.3 6.2 6.2 4.3 7.5 6.1 5.6 4.9 6.2 6.2 2.4
    #>  [37] 4.2 5.6 5.6 4.2 5.5 4.9 5.5 4.9 4.2 6.2 5.6 6.2 4.9 4.2 3.6 3.7 3.6 6.8
    #>  [55] 1.8 3.6 5.6 4.9 3.6 3.0 3.6 4.9 3.7 4.9 3.6 3.7 4.2 5.6 6.1 4.9 3.6 3.0
    #>  [73] 2.4 4.3 6.1 3.0 3.0 3.7 4.9 4.3 5.4 5.5 3.0 2.4 6.1 5.6 5.5 3.7 4.2 2.4
    #>  [91] 5.6 4.9 3.0 5.6 4.9 3.6 4.9 6.8 4.9 2.4 5.6 4.8 4.2 3.0 4.9 3.0 3.0 3.7
    #> [109] 4.9 3.7 6.2 4.9 5.5 5.6 5.6 4.8 3.7 6.2 3.0 5.4 4.9 3.6 5.4 3.0 4.8 3.6
    #> [127] 4.8 4.2 4.2 2.4 4.9 4.3 6.2 2.4 4.9 4.9 4.9 4.2 4.9 5.5 4.9 5.5 7.5 5.6
    #> [145] 5.5 3.0 4.9 6.1 4.9 5.5 3.0 5.6 6.2 4.9 4.3 4.9 5.6 4.2 2.4 5.5 4.9 3.7
    #> [163] 4.3 4.3 4.9 4.3 6.1 4.8 4.9 5.5 6.2 6.1 3.6 2.4 3.6 4.9 6.2 4.3 4.3 4.2
    #> [181] 3.6 3.6 3.6 6.1 7.5 3.0 5.5 4.9 5.6 3.6 4.3 5.4 3.7 3.0 6.2 6.8 2.4 3.0
    #> [199] 6.1 4.9 3.0 4.8 3.6 3.6 6.1 2.4 5.5 4.8 6.1 4.9 5.5 6.2 3.0 4.3 5.6 4.2
    #> [217] 4.3 3.7 4.9 5.5 6.2 4.3 4.9 5.4 4.2 3.6 6.1 6.8 7.5 3.0 4.2 3.6 5.5 4.2
    #> [235] 4.2 5.5 3.6 3.7 3.0  NA 5.5 3.6 4.2 3.7 6.8 4.9 4.9 5.5 3.0 3.7 4.3 3.0
    #> [253] 6.1 4.9 1.8 6.2 4.2 4.2 5.6 5.5 4.9 4.3 5.6 4.2 6.1 4.2 4.9 4.2 3.7 4.8
    #> [271] 3.6 2.4 3.6 3.6 4.3 5.6 4.9 4.9 4.9 6.1 6.1 3.6 6.1 3.6 3.7 4.9 3.6 4.2
    #> [289] 3.6 4.2 5.5 3.0 4.8 4.9 5.5 3.7  NA 3.7 5.4 3.6 4.3 5.5 3.6 4.2 5.6 4.2
    #> [307] 6.8 3.0 6.1 6.1 3.6  NA 4.8 5.5 3.6 6.1 4.3 3.0 6.8 6.2 3.0 6.1 1.8 3.7
    #> [325] 3.6 3.7 6.2 4.8 3.7 3.6 3.6 3.0 4.8 3.0 3.0 4.9 5.5 2.4 5.6 6.8 6.2 6.1
    #> [343] 3.0 4.9 4.9 6.2 2.4 3.0 4.2 3.6 1.8 4.9 4.2 4.9 4.9 5.6 3.0 4.9 6.1 6.1
    #> [361] 4.2 4.9 6.2 3.6 4.9 4.3 3.0 6.1 4.3 3.7 3.7 3.0 4.2 3.6 3.0 6.1 4.3 6.1
    #> [379] 2.4 5.5 5.6 5.5 5.5 4.9 5.5 4.2 4.2 4.3 4.3 4.9 3.0 5.5 5.6 5.6 3.6 6.1
    #> [397] 5.6 3.0 2.4 2.4 3.7 3.0 4.2 2.4 4.3 6.8 4.8 3.6 3.6 5.6 3.0 4.3 4.2 4.9
    #> [415] 6.2 3.7 4.9 3.6 6.8 3.6 5.4 4.9 4.8 4.2 5.5 5.5 5.5 4.8 4.2 4.9 3.7 5.6
    #> [433] 3.6 4.9 5.6 3.6 3.7 7.5 5.5 4.8 4.9 4.2 5.5 4.3 5.5 4.2 6.1 2.4 4.8 3.0
    #> [451] 5.4 5.5 3.6 1.8 6.1 1.8 4.8 4.9 2.4 4.2 4.3 3.6 1.8 3.7 4.3 3.0 2.4 5.6
    #> [469] 4.2 5.5 3.7 6.8 4.3 4.3 5.5 4.2 4.3 5.6 3.0 3.0 6.1 6.8 4.2 5.6 4.9 3.7
    #> [487] 5.5 4.3 4.8 7.5 6.2 7.5 5.5 4.9 1.8 5.5 4.2 3.7 4.2 2.4

#### Intrinsic motivation score

The `get_intrinsic_motivation_score()` function computes an intrinsic motivation score that ranges from 1.5 to 7.5 based on responses to three items from the Behavioral Regulation in Exercise Questionnaire (BREQ) as they appear in the CAPL-2 questionnaire. This score is used to compute the motivation and confidence domain score.

    capl_demo_data$intrinsic_motivation_score <- get_intrinsic_motivation_score(
      why_active1 = capl_demo_data$why_active1,
      why_active2 = capl_demo_data$why_active2,
      why_active3 = capl_demo_data$why_active3
    )

    capl_demo_data$intrinsic_motivation_score
    #>   [1] 6.0 4.5 5.0 4.5 4.0 5.5 6.5  NA 5.5  NA 6.5 5.0 4.0 3.5  NA 6.0 4.5 4.5
    #>  [19] 5.0 3.0 2.0 2.5 3.5  NA 5.0 4.0 4.5 7.0 3.5 4.0  NA 6.0 5.0 3.5  NA 4.5
    #>  [37] 4.5  NA 5.0 5.0 4.0 3.5 6.5 4.0  NA 4.5 3.0  NA 5.0 5.0 4.0 6.5  NA 4.0
    #>  [55] 5.0 3.5 6.5 2.5 6.5 5.0 6.0 5.5 4.5 3.5 3.0 2.5 4.5 4.5 4.5 4.5 4.5 3.0
    #>  [73] 4.5 4.5 5.0 5.0 2.5 6.5 5.5 4.5 6.0 2.5 4.0 7.0 4.5  NA 3.5  NA 3.5 3.0
    #>  [91] 4.0 4.0 5.0 5.0 2.5  NA 3.5 6.0 1.5 6.5 5.5 5.5 5.5 4.0 4.0 4.0  NA 3.0
    #> [109]  NA 4.0 5.0 5.5 3.5 4.0 3.0 4.0 6.5 3.5 6.0 3.0 4.5 6.0  NA 3.0 3.5  NA
    #> [127] 5.0 3.0  NA 5.5 5.5 6.5 4.0  NA 5.0 5.0 5.0  NA 3.0 2.5  NA 4.0 6.0 5.0
    #> [145] 5.0 3.5 4.5 5.0  NA 4.5 2.5 4.0 4.0 5.5 3.0 7.0 5.0 5.0 5.0  NA 5.5 7.5
    #> [163] 4.0 2.5 3.5 5.5  NA 4.5 6.0 5.0 5.0 5.5 2.5 4.5 5.5 2.0 5.0 7.0  NA 6.0
    #> [181] 2.5 2.5 3.5 5.0 3.5 4.5 5.5 6.5 5.5 4.5 4.5 6.0 5.5 6.0 4.0  NA 2.5 6.5
    #> [199]  NA 2.5 3.0 5.0 2.5 5.5 5.5  NA 3.0 3.0 4.5 4.5 3.0 3.0 5.0  NA 6.0 3.5
    #> [217] 4.5 7.0 2.5 3.0 3.0 5.0 4.5 6.5 4.5 5.5  NA 5.0 6.0 5.5  NA 3.0 2.5  NA
    #> [235] 4.5 4.0 4.0 3.5 4.5 5.0 4.0 7.5 2.0 6.5 5.0 5.0 3.5  NA 4.5 2.5 3.0  NA
    #> [253] 4.5 5.5  NA  NA 5.5 3.5 5.0 5.5 4.5 4.5 4.0 4.5  NA 5.0 6.5 5.5 4.5 6.0
    #> [271] 4.0 5.0  NA 5.5 4.0 4.0 4.0 5.0 5.5 6.5  NA 4.0 4.5  NA 5.0 4.5 6.0 3.0
    #> [289]  NA  NA 3.5 3.5 6.0 4.0 3.5 4.5 7.0 5.0 6.0 4.0 5.0 6.0 1.5 4.5  NA 4.0
    #> [307]  NA 2.5 4.5 4.5 2.5 4.5 3.0 3.5 6.5 3.5 5.5 4.0 5.0 3.0 4.0 4.0 6.5 4.5
    #> [325] 6.5 3.5  NA 2.0 6.5 5.5 2.5 5.5 3.5 5.5 4.5 4.0 5.0 4.0 4.5 4.0 4.5 3.5
    #> [343]  NA  NA 2.5 5.5 2.5 4.5 3.5 6.5 7.5 5.0  NA 4.0 4.0 3.5  NA 6.0  NA 5.0
    #> [361] 5.5 4.5 4.5  NA 3.0 5.0 7.5 5.5  NA 2.5 4.5  NA 4.0 3.0 3.5 6.0 3.5 5.5
    #> [379] 2.5 4.0 2.0 5.5 6.0 6.0 6.0 4.5 5.0 5.0 5.0 4.5 4.0 3.5 6.5  NA 5.5 3.5
    #> [397] 4.0 3.5 6.0 4.5 5.5 4.5 7.0 5.0 6.5  NA 5.5 5.5 4.5 5.0 4.0 4.0 4.5 4.0
    #> [415] 2.5 5.0 4.0  NA 5.5 3.0 4.0 3.5 7.0 3.5 4.0 6.5 2.0 5.5 4.0 4.5  NA 5.5
    #> [433]  NA 5.0 3.5 4.5 5.0 4.5 4.5 3.0  NA 4.0 6.5 5.5 5.5 4.5 3.0 5.0 5.5  NA
    #> [451] 6.0 5.0 2.0  NA  NA 2.5 2.5 6.5 3.5 3.5 4.0 5.5 4.5 4.5 4.0 4.5 3.5 5.5
    #> [469] 3.0  NA  NA 5.0 6.5 5.0 3.5 4.5 2.0 4.0  NA 4.5 4.5 4.5 3.5 5.5  NA 5.0
    #> [487] 5.0 5.0 5.5 4.5 4.5 5.5 4.5 6.5 3.5 2.5 4.5 4.5 4.5 5.5

#### Physical activity competence score

The `get_pa_competence_score()` function computes a physical activity competence score that ranges from 1.5 to 7.5 based on responses to three items from the Behavioral Regulation in Exercise Questionnaire (BREQ) as they appear in the CAPL-2 Questionnaire. This score is used to compute the motivation and confidence domain score.

    capl_demo_data$pa_competence_score <- get_pa_competence_score(
      feelings_about_pa1 = capl_demo_data$feelings_about_pa1,
      feelings_about_pa2 = capl_demo_data$feelings_about_pa2,
      feelings_about_pa3 = capl_demo_data$feelings_about_pa3
    )

    capl_demo_data$pa_competence_score
    #>   [1] 5.5 5.0 3.0 5.0 4.0 2.5 4.5 4.5 4.5 6.0 4.5 4.0 3.5 4.0 4.0 3.5 5.0 3.5
    #>  [19] 5.0 6.0 5.5 4.0  NA 4.5 5.5  NA 5.0 4.0 5.0 5.0 4.0  NA 3.0  NA 4.5 3.0
    #>  [37] 6.0  NA 1.5 3.5 4.5 6.5 2.5 5.5 3.5 6.0 4.0 6.5 5.5 5.0 6.0  NA 3.0 5.5
    #>  [55] 5.0 5.0 5.5  NA 5.0 5.0 5.0  NA 4.5 5.0 4.0 7.0 3.5 5.5 4.5 4.5  NA 2.5
    #>  [73] 4.0 3.5 4.5 5.0 4.0 4.0 3.5 3.5 2.5 5.0 5.0 3.0 5.0 3.0 5.0  NA 3.0 3.5
    #>  [91] 3.5 5.0 5.0  NA  NA 5.0 3.5 5.0 5.0 4.0  NA 3.5 5.0 4.5 5.5 7.5 4.0 5.0
    #> [109]  NA 4.0 6.0  NA 5.5 6.0 5.5 3.0 4.0 3.5 4.0 6.0 3.5 4.0  NA 5.0 6.0 7.0
    #> [127] 4.0 4.5 4.5 2.5  NA 2.5 7.5 4.5 4.0 4.0  NA 3.0 4.0 5.5  NA 4.0 3.5 4.5
    #> [145] 3.5 5.0 3.0  NA 5.5 4.5 5.5 3.5 6.0 5.0 6.5 6.0 4.0 2.0 4.0  NA 2.5 4.5
    #> [163] 4.5 5.0 6.0 5.5 2.0 7.0  NA 3.5 3.5  NA 5.0  NA 5.5 6.0 5.5 5.0 4.0 4.0
    #> [181] 5.5 3.5 5.0 5.0 5.5 5.0 6.0  NA 2.0 3.0 3.5 3.5 4.5 3.0 3.5  NA  NA 3.5
    #> [199] 2.0 3.0 4.0 5.5 6.5 4.5 3.5 3.0 3.5 6.5 5.0 5.5 3.5 4.5 2.5 3.5  NA 4.5
    #> [217] 2.5 7.0 5.0 5.0 5.5  NA 4.5 3.5 4.5 4.0 5.0 4.0 4.5 3.0 2.0 4.0 6.0  NA
    #> [235] 3.5 5.0 3.0 3.5 5.0 4.5 2.5 5.0  NA  NA 4.5 5.5 6.5 4.5 6.0 3.5 6.5 4.5
    #> [253] 3.0 3.5 5.5  NA 5.5 4.0 4.0 4.5 5.5 3.5 3.5 5.0 3.5 4.5 4.5 6.0 4.5 6.0
    #> [271] 4.0  NA 7.0 4.5 6.0 5.0 5.0 5.0 6.0 3.0 3.5 2.0 2.5 3.0 5.0  NA 4.0 5.0
    #> [289] 5.5 6.5 4.5  NA 7.0  NA 3.5  NA 3.0  NA 6.0 6.0 6.0  NA 3.5  NA 4.0  NA
    #> [307] 6.0  NA 4.5 6.0 4.0 4.5 4.0 5.0 4.0 4.5 6.5 4.5 5.5 5.0 5.5 3.0 3.5 4.5
    #> [325] 6.5 5.5 2.5 4.5 5.0 4.5 4.5 4.5 4.0 4.5 4.5 5.5 3.5 5.0 4.5 6.0 4.0 4.5
    #> [343] 4.5 5.0 4.0 4.0  NA 6.0 6.0 5.0 2.5 4.0 3.5 6.0  NA 5.0 3.5 5.0 4.0  NA
    #> [361] 6.5 4.0 3.0 5.5 5.5 6.0 5.5  NA  NA 7.0 6.0 5.0 4.5 4.5 4.5 3.5 3.5 3.0
    #> [379] 3.0 4.5 6.0 4.0  NA 5.5  NA 6.0 5.5 7.5 4.5 3.5 6.5 3.5 4.5 2.5 4.5 5.5
    #> [397] 4.5 4.0  NA  NA 7.0 6.5 4.0 5.0  NA 4.5 4.5 6.0 5.5 6.0 6.0 2.5 5.0 5.5
    #> [415] 6.0 5.0 3.0 3.5 5.0 6.5 3.0 2.5 3.0  NA 3.0 3.5 4.0 4.0 5.5  NA 3.5 3.0
    #> [433] 5.0 7.0 5.0 4.5 5.0  NA  NA 2.0  NA 6.0 6.0 4.0 5.0 7.0 2.5 2.5 6.5 4.5
    #> [451] 6.5 3.0 4.0 5.0 5.0 3.5 4.0 6.5 4.0 4.5  NA 6.0 6.0 5.0 4.5 5.0 3.5 3.5
    #> [469] 4.5 4.5 4.5 4.5 5.0 4.5 5.5  NA 6.0 4.0 3.5 6.5 4.0 4.5 4.5 5.5 5.0 6.5
    #> [487] 3.0 3.5 6.5 4.5  NA 2.0 4.0 4.0 4.0 4.5 2.5 3.5 3.5 6.0

#### Motivation and confidence score

The `get_mc_score()` function computes a motivation and confidence domain score that ranges from zero to 30 based on the predilection, adequacy, intrinsic motivation and physical activity competence scores. If one of the scores is missing or invalid, a weighted domain score will be computed from the other three scores. This score is used to compute the overall physical literacy score.

    capl_demo_data$mc_score <- get_mc_score(
      predilection_score = capl_demo_data$predilection_score,
      adequacy_score = capl_demo_data$adequacy_score,
      intrinsic_motivation_score = capl_demo_data$intrinsic_motivation_score,
      pa_competence_score = capl_demo_data$pa_competence_score
    )

    capl_demo_data$mc_score
    #>   [1] 17.50000 19.90000 21.00000 16.80000 18.00000 16.50000 21.40000 18.26667
    #>   [9] 18.40000 20.26667 20.20000 16.90000 18.00000 16.60000 18.40000 20.60000
    #>  [17] 18.60000 17.10000 20.40000 18.80000 16.00000 14.90000 19.33333 15.60000
    #>  [25] 21.60000 17.46667 21.30000 20.20000 17.10000 20.80000 21.60000 22.00000
    #>  [33] 19.10000 17.73333 23.33333 15.40000 20.20000       NA 15.10000 15.10000
    #>  [41] 18.30000 18.50000 20.00000 20.50000       NA 21.00000 15.00000 23.46667
    #>  [49] 20.30000 18.93333 19.10000 19.33333 14.40000 20.50000 19.86667 18.30000
    #>  [57] 21.90000 17.20000 20.13333 16.70000 19.50000 18.80000 19.50000 18.20000
    #>  [65] 16.80000 17.40000 15.90000 20.80000 20.60000 16.90000 18.13333 12.70000
    #>  [73] 15.70000 17.80000 20.50000 16.60000 14.40000 17.90000 17.50000 15.90000
    #>  [81] 18.80000 19.20000 16.20000 16.10000 19.30000 16.26667 17.00000       NA
    #>  [89] 14.90000 13.10000 16.10000 19.30000 18.50000 22.40000 15.60000 16.26667
    #>  [97] 17.50000 23.90000 16.30000 17.20000 20.40000 19.30000 21.50000 16.30000
    #> [105] 19.30000 19.40000 15.86667 14.10000       NA 14.70000 20.80000 18.66667
    #> [113] 19.40000 19.20000 18.40000 15.50000 16.60000 16.20000 16.60000 18.60000
    #> [121] 17.20000 17.90000       NA 16.60000 19.20000 22.40000 16.80000 14.70000
    #> [129] 18.93333 14.00000 19.46667 17.00000 23.80000 14.13333 17.50000 20.10000
    #> [137] 21.33333 16.00000 15.50000 18.40000       NA 19.10000 20.00000 20.00000
    #> [145] 18.90000 16.30000 15.40000 21.20000 19.46667 19.40000 13.40000 18.60000
    #> [153] 19.90000 19.70000 17.40000 20.90000 19.40000 16.70000 18.90000       NA
    #> [161] 17.70000 19.90000 15.80000 14.20000 19.90000 17.70000 18.13333 22.40000
    #> [169] 19.33333 19.50000 19.00000 21.06667 15.40000       NA 20.70000 16.50000
    #> [177] 21.60000 21.90000 16.00000 16.60000 17.20000 12.60000 16.30000 19.80000
    #> [185] 21.90000 18.70000 21.20000 20.93333 16.70000 16.60000 17.80000 18.50000
    #> [193] 18.60000 15.60000 18.60000       NA 13.06667 17.20000 17.33333 14.70000
    #> [201] 16.20000 17.70000 16.90000 17.20000 21.90000 13.73333 16.90000 20.40000
    #> [209] 18.00000 22.40000 17.50000 18.00000 16.70000 17.86667 21.86667 15.20000
    #> [217] 16.90000 21.30000 17.30000 19.60000 19.00000 18.80000 18.10000 19.00000
    #> [225] 17.50000 19.20000 23.86667 20.70000 21.00000 15.10000 12.26667 16.20000
    #> [233] 18.90000       NA 18.40000 20.10000 14.13333 14.26667 18.00000 17.46667
    #> [241] 16.30000 22.30000 14.80000 20.00000 19.90000 20.90000 19.80000 20.66667
    #> [249] 18.40000 15.80000 18.70000 15.73333 20.40000 17.50000       NA       NA
    #> [257] 20.00000 17.20000 18.80000 18.50000 21.10000 17.10000 16.70000 17.90000
    #> [265] 18.53333 18.60000 23.40000 20.00000 18.20000 21.70000 15.46667 14.66667
    #> [273] 21.46667 17.80000 19.90000 18.80000 18.80000 17.90000 20.10000 19.90000
    #> [281] 19.33333 14.40000 16.10000 13.60000 18.60000 19.06667 19.70000 17.10000
    #> [289] 17.73333 19.06667 19.00000 16.00000 20.20000 15.06667 16.20000 18.26667
    #> [297] 20.53333 19.86667 21.10000 20.40000 19.50000 25.33333 14.20000 16.53333
    #> [305] 18.40000 18.26667 22.80000 14.53333 20.00000 20.20000 14.90000 18.40000
    #> [313] 16.00000 20.10000 18.40000 17.10000 20.00000 18.30000 20.90000 17.20000
    #> [321] 18.70000 17.90000 18.93333 18.20000 20.90000 16.90000 18.13333 15.60000
    #> [329] 18.20000 16.60000 15.50000 17.30000 16.60000 19.20000 18.10000 18.70000
    #> [337] 18.20000 17.00000 18.20000 22.90000 19.60000 18.40000 20.00000 21.46667
    #> [345] 15.70000 19.30000 14.80000 17.70000 17.90000 19.40000 16.53333 17.50000
    #> [353]       NA 20.40000 19.20000 19.60000 13.60000 23.40000 20.80000 22.13333
    #> [361] 23.70000 19.60000 17.40000 16.93333 17.00000 17.70000 19.00000 19.46667
    #> [369]       NA 19.30000 19.10000 18.00000 17.00000 14.10000 15.90000 19.20000
    #> [377] 15.60000 18.80000 12.10000 17.70000 16.60000 18.60000 21.06667 20.70000
    #> [385] 21.86667 17.70000 19.60000 21.10000 18.00000 16.50000 19.60000 16.70000
    #> [393] 21.50000 17.33333 19.10000 21.90000 19.70000 15.40000 16.80000 14.00000
    #> [401] 19.80000 18.20000 19.40000 16.70000 20.13333 23.20000 20.90000 20.70000
    #> [409] 17.20000 22.10000 18.50000 13.80000 19.80000 17.40000 20.90000 19.30000
    #> [417] 16.80000 13.46667 20.90000 17.40000 16.00000 14.60000 20.90000 13.46667
    #> [425] 18.10000 20.40000 17.00000 21.80000 19.20000 17.46667 15.33333 20.30000
    #> [433] 18.00000 21.80000 18.30000 16.90000 17.30000 21.60000 18.93333 13.40000
    #> [441]       NA 19.70000 20.40000 17.40000 20.80000 21.80000 15.80000 12.30000
    #> [449] 19.80000 16.53333 21.60000 18.40000 13.20000       NA 19.60000 14.53333
    #> [457] 16.10000 22.10000 12.90000 19.00000 18.40000 18.80000 18.80000 19.40000
    #> [465] 17.70000 16.10000 13.00000 18.30000 14.70000 18.93333 14.93333 20.60000
    #> [473] 22.00000 20.60000 19.90000 17.33333 16.60000 18.13333 16.80000 17.00000
    #> [481] 19.50000 18.80000 17.10000 23.40000 20.53333 20.10000 19.60000 15.80000
    #> [489] 21.70000 20.70000 19.86667 19.20000 16.40000 19.00000 15.73333 18.00000
    #> [497] 14.90000 17.80000 14.60000 18.10000

#### Motivation and confidence interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$mc_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$mc_score,
      protocol = "mc"
    )

    capl_demo_data$mc_interpretation
    #>   [1] "progressing" "progressing" "progressing" "progressing" "progressing"
    #>   [6] "beginning"   "progressing" "progressing" "progressing" "progressing"
    #>  [11] NA            "progressing" NA            NA            "progressing"
    #>  [16] "progressing" "progressing" "progressing" "progressing" "progressing"
    #>  [21] "beginning"   "beginning"   "progressing" NA            NA
    #>  [26] NA            "progressing" NA            "progressing" "progressing"
    #>  [31] "progressing" "progressing" "progressing" NA            "achieving"
    #>  [36] NA            NA            NA            "beginning"   "beginning"
    #>  [41] "progressing" "progressing" "progressing" "progressing" NA
    #>  [46] "progressing" "beginning"   "achieving"   NA            NA
    #>  [51] "progressing" "progressing" "beginning"   "progressing" "progressing"
    #>  [56] "progressing" "progressing" "progressing" "progressing" "progressing"
    #>  [61] "progressing" NA            "progressing" "progressing" "progressing"
    #>  [66] NA            "beginning"   "progressing" NA            "progressing"
    #>  [71] "progressing" "beginning"   "beginning"   "progressing" NA
    #>  [76] "progressing" NA            "progressing" "progressing" "beginning"
    #>  [81] NA            "progressing" "progressing" "beginning"   "progressing"
    #>  [86] NA            "progressing" NA            "beginning"   "beginning"
    #>  [91] "beginning"   "progressing" NA            NA            NA
    #>  [96] "beginning"   NA            "achieving"   "beginning"   "progressing"
    #> [101] "progressing" "progressing" "progressing" NA            "progressing"
    #> [106] "progressing" "beginning"   "beginning"   NA            "beginning"
    #> [111] "progressing" "progressing" "progressing" NA            "progressing"
    #> [116] "beginning"   "progressing" "beginning"   "beginning"   "progressing"
    #> [121] NA            "progressing" NA            "progressing" "progressing"
    #> [126] NA            "progressing" NA            NA            "beginning"
    #> [131] "progressing" NA            "achieving"   "beginning"   "progressing"
    #> [136] "progressing" "progressing" "beginning"   "beginning"   "progressing"
    #> [141] NA            "progressing" "progressing" "progressing" "progressing"
    #> [146] "progressing" NA            NA            "progressing" "progressing"
    #> [151] "beginning"   "progressing" "progressing" "progressing" "progressing"
    #> [156] "progressing" "progressing" "progressing" "progressing" NA
    #> [161] NA            "progressing" "beginning"   "beginning"   NA
    #> [166] "progressing" "progressing" NA            "progressing" "progressing"
    #> [171] "progressing" "progressing" "beginning"   NA            "progressing"
    #> [176] "progressing" "progressing" NA            NA            "beginning"
    #> [181] "progressing" NA            "beginning"   NA            "progressing"
    #> [186] "progressing" "progressing" "progressing" "progressing" NA
    #> [191] "progressing" "progressing" "progressing" "beginning"   NA
    #> [196] NA            "beginning"   "progressing" "progressing" NA
    #> [201] "beginning"   "progressing" "progressing" "progressing" "progressing"
    #> [206] "beginning"   "progressing" "progressing" "progressing" NA
    #> [211] NA            "progressing" "beginning"   "progressing" "progressing"
    #> [216] "beginning"   NA            "progressing" "progressing" "progressing"
    #> [221] "progressing" "progressing" NA            NA            "progressing"
    #> [226] "progressing" "achieving"   NA            "progressing" NA
    #> [231] "beginning"   "beginning"   "progressing" NA            "progressing"
    #> [236] "progressing" "beginning"   "beginning"   "progressing" "progressing"
    #> [241] "progressing" "progressing" NA            NA            NA
    #> [246] "progressing" "progressing" NA            NA            "beginning"
    #> [251] NA            "beginning"   NA            "progressing" NA
    #> [256] NA            "progressing" "progressing" "progressing" NA
    #> [261] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [266] "progressing" "achieving"   "progressing" "progressing" "progressing"
    #> [271] "beginning"   "beginning"   NA            "progressing" "progressing"
    #> [276] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [281] "progressing" NA            "beginning"   "beginning"   "progressing"
    #> [286] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [291] "progressing" "beginning"   "progressing" "beginning"   NA
    #> [296] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [301] "progressing" "achieving"   "beginning"   "beginning"   "progressing"
    #> [306] "progressing" "achieving"   NA            NA            "progressing"
    #> [311] "beginning"   "progressing" "beginning"   "progressing" "progressing"
    #> [316] "progressing" "progressing" "progressing" "progressing" NA
    #> [321] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [326] NA            "progressing" "beginning"   "progressing" "progressing"
    #> [331] "beginning"   "progressing" "beginning"   "progressing" "progressing"
    #> [336] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [341] NA            NA            "progressing" "progressing" "beginning"
    #> [346] "progressing" "beginning"   "progressing" "progressing" "progressing"
    #> [351] NA            NA            NA            "progressing" "progressing"
    #> [356] "progressing" NA            "achieving"   "progressing" "progressing"
    #> [361] NA            "progressing" NA            "progressing" "progressing"
    #> [366] "progressing" "progressing" "progressing" NA            "progressing"
    #> [371] "progressing" "progressing" "progressing" NA            "beginning"
    #> [376] "progressing" "beginning"   NA            NA            "progressing"
    #> [381] "beginning"   "progressing" "progressing" "progressing" "progressing"
    #> [386] "progressing" "progressing" NA            "progressing" "progressing"
    #> [391] "progressing" "beginning"   NA            "progressing" "progressing"
    #> [396] "progressing" "progressing" NA            "progressing" "beginning"
    #> [401] NA            "progressing" "progressing" "progressing" "progressing"
    #> [406] "achieving"   NA            "progressing" "progressing" "progressing"
    #> [411] NA            "beginning"   "progressing" "progressing" "progressing"
    #> [416] "progressing" "progressing" "beginning"   "progressing" NA
    #> [421] "beginning"   "beginning"   "progressing" "beginning"   "progressing"
    #> [426] "progressing" "progressing" "progressing" "progressing" "progressing"
    #> [431] "beginning"   "progressing" "progressing" NA            "progressing"
    #> [436] "progressing" "progressing" "progressing" "progressing" "beginning"
    #> [441] NA            "progressing" "progressing" "progressing" "progressing"
    #> [446] "progressing" "beginning"   "beginning"   "progressing" NA
    #> [451] "progressing" "progressing" NA            NA            "progressing"
    #> [456] "beginning"   "beginning"   "progressing" "beginning"   "progressing"
    #> [461] NA            "progressing" "progressing" "progressing" NA
    #> [466] "beginning"   "beginning"   NA            NA            NA
    #> [471] "beginning"   "progressing" NA            "progressing" "progressing"
    #> [476] "progressing" NA            "progressing" "progressing" "progressing"
    #> [481] NA            "progressing" "progressing" NA            "progressing"
    #> [486] NA            "progressing" NA            "progressing" "progressing"
    #> [491] "progressing" "progressing" "progressing" "progressing" "beginning"
    #> [496] "progressing" NA            NA            "beginning"   "progressing"

#### Motivation and confidence domain status

The `get_capl_domain_status()` function computes the status (“complete”, “missing interpretation”, “missing protocol” or “incomplete”) of a CAPL domain.

    capl_demo_data$mc_status <- get_capl_domain_status(
      x = capl_demo_data,
      domain = "mc"
    )

    capl_demo_data$mc_status
    #>   [1] "complete"               "complete"               "complete"
    #>   [4] "complete"               "missing protocol"       "complete"
    #>   [7] "complete"               "missing protocol"       "complete"
    #>  [10] "missing protocol"       "missing interpretation" "complete"
    #>  [13] "missing interpretation" "missing interpretation" "missing protocol"
    #>  [16] "complete"               "complete"               "complete"
    #>  [19] "complete"               "complete"               "complete"
    #>  [22] "complete"               "missing protocol"       "missing interpretation"
    #>  [25] "missing interpretation" "missing interpretation" "complete"
    #>  [28] "missing interpretation" "complete"               "complete"
    #>  [31] "missing protocol"       "missing protocol"       "complete"
    #>  [34] "missing interpretation" "missing protocol"       "missing interpretation"
    #>  [37] "missing interpretation" "incomplete"             "complete"
    #>  [40] "complete"               "complete"               "complete"
    #>  [43] "complete"               "complete"               "incomplete"
    #>  [46] "complete"               "complete"               "missing protocol"
    #>  [49] "missing interpretation" "missing interpretation" "complete"
    #>  [52] "missing protocol"       "missing protocol"       "complete"
    #>  [55] "complete"               "complete"               "complete"
    #>  [58] "missing protocol"       "complete"               "complete"
    #>  [61] "complete"               "missing interpretation" "complete"
    #>  [64] "complete"               "complete"               "missing interpretation"
    #>  [67] "complete"               "complete"               "missing interpretation"
    #>  [70] "complete"               "missing protocol"       "complete"
    #>  [73] "complete"               "complete"               "missing interpretation"
    #>  [76] "complete"               "missing interpretation" "complete"
    #>  [79] "complete"               "complete"               "missing interpretation"
    #>  [82] "complete"               "complete"               "complete"
    #>  [85] "complete"               "missing interpretation" "complete"
    #>  [88] "incomplete"             "complete"               "complete"
    #>  [91] "complete"               "complete"               "missing interpretation"
    #>  [94] "missing interpretation" "missing interpretation" "missing protocol"
    #>  [97] "missing interpretation" "complete"               "complete"
    #> [100] "missing protocol"       "missing protocol"       "complete"
    #> [103] "complete"               "missing interpretation" "complete"
    #> [106] "complete"               "missing protocol"       "complete"
    #> [109] "incomplete"             "complete"               "complete"
    #> [112] "missing protocol"       "complete"               "missing interpretation"
    #> [115] "complete"               "complete"               "complete"
    #> [118] "complete"               "complete"               "complete"
    #> [121] "missing interpretation" "complete"               "incomplete"
    #> [124] "complete"               "complete"               "missing interpretation"
    #> [127] "complete"               "missing interpretation" "missing interpretation"
    #> [130] "complete"               "missing protocol"       "missing interpretation"
    #> [133] "complete"               "missing protocol"       "complete"
    #> [136] "complete"               "missing protocol"       "missing protocol"
    #> [139] "complete"               "complete"               "incomplete"
    #> [142] "complete"               "complete"               "complete"
    #> [145] "complete"               "complete"               "missing interpretation"
    #> [148] "missing interpretation" "missing protocol"       "complete"
    #> [151] "complete"               "complete"               "complete"
    #> [154] "complete"               "complete"               "complete"
    #> [157] "complete"               "complete"               "complete"
    #> [160] "incomplete"             "missing interpretation" "complete"
    #> [163] "complete"               "complete"               "missing interpretation"
    #> [166] "complete"               "missing protocol"       "missing interpretation"
    #> [169] "missing protocol"       "complete"               "complete"
    #> [172] "missing protocol"       "complete"               "incomplete"
    #> [175] "complete"               "complete"               "complete"
    #> [178] "missing interpretation" "missing interpretation" "complete"
    #> [181] "complete"               "missing interpretation" "complete"
    #> [184] "missing interpretation" "complete"               "complete"
    #> [187] "complete"               "missing protocol"       "complete"
    #> [190] "missing interpretation" "complete"               "complete"
    #> [193] "complete"               "complete"               "missing interpretation"
    #> [196] "incomplete"             "missing protocol"       "complete"
    #> [199] "missing protocol"       "missing interpretation" "complete"
    #> [202] "complete"               "complete"               "complete"
    #> [205] "complete"               "missing protocol"       "complete"
    #> [208] "complete"               "complete"               "missing interpretation"
    #> [211] "missing interpretation" "complete"               "complete"
    #> [214] "missing protocol"       "missing protocol"       "complete"
    #> [217] "missing interpretation" "complete"               "complete"
    #> [220] "complete"               "complete"               "missing protocol"
    #> [223] "missing interpretation" "missing interpretation" "complete"
    #> [226] "complete"               "missing protocol"       "missing interpretation"
    #> [229] "complete"               "missing interpretation" "missing protocol"
    #> [232] "complete"               "complete"               "incomplete"
    #> [235] "complete"               "complete"               "complete"
    #> [238] "missing protocol"       "complete"               "missing protocol"
    #> [241] "complete"               "complete"               "missing interpretation"
    #> [244] "missing interpretation" "missing interpretation" "complete"
    #> [247] "complete"               "missing interpretation" "missing interpretation"
    #> [250] "complete"               "missing interpretation" "missing protocol"
    #> [253] "missing interpretation" "complete"               "incomplete"
    #> [256] "incomplete"             "complete"               "complete"
    #> [259] "complete"               "missing interpretation" "complete"
    #> [262] "complete"               "complete"               "complete"
    #> [265] "missing protocol"       "complete"               "complete"
    #> [268] "complete"               "complete"               "complete"
    #> [271] "complete"               "missing protocol"       "missing interpretation"
    #> [274] "complete"               "complete"               "complete"
    #> [277] "complete"               "complete"               "complete"
    #> [280] "complete"               "missing protocol"       "missing interpretation"
    #> [283] "complete"               "missing protocol"       "complete"
    #> [286] "missing protocol"       "complete"               "complete"
    #> [289] "missing protocol"       "missing protocol"       "complete"
    #> [292] "missing protocol"       "complete"               "missing protocol"
    #> [295] "missing interpretation" "missing protocol"       "missing protocol"
    #> [298] "missing protocol"       "complete"               "complete"
    #> [301] "complete"               "missing protocol"       "complete"
    #> [304] "missing protocol"       "missing protocol"       "missing protocol"
    #> [307] "missing protocol"       "missing interpretation" "missing interpretation"
    #> [310] "complete"               "complete"               "missing protocol"
    #> [313] "complete"               "complete"               "complete"
    #> [316] "complete"               "complete"               "complete"
    #> [319] "complete"               "missing interpretation" "complete"
    #> [322] "complete"               "complete"               "complete"
    #> [325] "complete"               "missing interpretation" "missing protocol"
    #> [328] "complete"               "complete"               "complete"
    #> [331] "complete"               "complete"               "complete"
    #> [334] "complete"               "complete"               "complete"
    #> [337] "complete"               "complete"               "complete"
    #> [340] "complete"               "missing interpretation" "missing interpretation"
    #> [343] "missing protocol"       "missing protocol"       "complete"
    #> [346] "complete"               "missing protocol"       "complete"
    #> [349] "complete"               "complete"               "missing interpretation"
    #> [352] "missing interpretation" "incomplete"             "complete"
    #> [355] "missing protocol"       "complete"               "missing interpretation"
    #> [358] "complete"               "missing protocol"       "missing protocol"
    #> [361] "missing interpretation" "complete"               "missing interpretation"
    #> [364] "missing protocol"       "complete"               "complete"
    #> [367] "complete"               "missing protocol"       "incomplete"
    #> [370] "complete"               "complete"               "missing protocol"
    #> [373] "complete"               "missing interpretation" "complete"
    #> [376] "complete"               "complete"               "missing interpretation"
    #> [379] "missing interpretation" "complete"               "complete"
    #> [382] "complete"               "missing protocol"       "complete"
    #> [385] "missing protocol"       "complete"               "complete"
    #> [388] "missing interpretation" "complete"               "complete"
    #> [391] "complete"               "complete"               "missing interpretation"
    #> [394] "missing protocol"       "complete"               "complete"
    #> [397] "complete"               "missing interpretation" "missing protocol"
    #> [400] "missing protocol"       "missing interpretation" "complete"
    #> [403] "complete"               "complete"               "missing protocol"
    #> [406] "missing protocol"       "missing interpretation" "complete"
    #> [409] "complete"               "complete"               "missing interpretation"
    #> [412] "complete"               "complete"               "complete"
    #> [415] "complete"               "complete"               "complete"
    #> [418] "missing protocol"       "complete"               "missing interpretation"
    #> [421] "complete"               "complete"               "complete"
    #> [424] "missing protocol"       "complete"               "complete"
    #> [427] "complete"               "complete"               "complete"
    #> [430] "missing protocol"       "missing protocol"       "complete"
    #> [433] "missing protocol"       "missing interpretation" "complete"
    #> [436] "complete"               "complete"               "missing protocol"
    #> [439] "missing protocol"       "complete"               "incomplete"
    #> [442] "complete"               "complete"               "complete"
    #> [445] "complete"               "complete"               "complete"
    #> [448] "complete"               "complete"               "missing interpretation"
    #> [451] "complete"               "complete"               "missing interpretation"
    #> [454] "incomplete"             "missing protocol"       "complete"
    #> [457] "complete"               "complete"               "complete"
    #> [460] "complete"               "missing interpretation" "complete"
    #> [463] "complete"               "complete"               "missing interpretation"
    #> [466] "complete"               "complete"               "missing interpretation"
    #> [469] "missing interpretation" "missing interpretation" "missing protocol"
    #> [472] "complete"               "missing interpretation" "complete"
    #> [475] "complete"               "missing protocol"       "missing interpretation"
    #> [478] "missing protocol"       "missing protocol"       "complete"
    #> [481] "missing interpretation" "complete"               "complete"
    #> [484] "missing interpretation" "missing protocol"       "missing interpretation"
    #> [487] "complete"               "missing interpretation" "complete"
    #> [490] "complete"               "missing protocol"       "complete"
    #> [493] "complete"               "complete"               "complete"
    #> [496] "complete"               "missing interpretation" "missing interpretation"
    #> [499] "complete"               "complete"

### Knowledge and understanding functions

As illustrated in the CAPL-2 manual on page 75, the formula for computing the knowledge and understanding score is:

#### Physical activity guideline score

The `get_binary()` function computes a binary score (0 = incorrect answer, 1 = correct answer) for a response to a questionnaire item based on the value(s) set as answer(s) to the item.

    capl_demo_data$pa_guideline_score <- get_binary_score(
      capl_demo_data$pa_guideline,
      c(3, "60 minutes or 1 hour")
    )

    capl_demo_data$pa_guideline_score
    #>   [1]  0  1  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    #>  [26]  1  1  0  0  0  0  0  0  1  1  0  0  0  0  1  0  0  0  1  0  1  0  0  1  0
    #>  [51]  0  0  0  0  0  0  0  0  1  1  0  0  0  0  0  0  0  1  0  0  0  0  1  0  1
    #>  [76]  0  0  0  1  1  1  0  0  1  0  0  1  0  0  1  0  1  0  0  1  1  0  0  0  1
    #> [101]  0  0  1  0  1  0  1  0  0  0  0  0  0  0  0  1  0  0  0  1  1  1  1  0  1
    #> [126]  0  0  0  0  0  1  0  0  0  0  0  1  0  0  1  1  0  0  1  1  1  0  0  0  0
    #> [151]  0  0  0  0  0  0  1  1  0  0  0  1  0  1  0  0  0  0  0  1  0  1  0  0  0
    #> [176]  0  1  0  1  0  0  1  1  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  1
    #> [201]  0  1  0  0  0  0  1  1  0  0  0  0  0  0  1  0  0  0  1  0  0  0  0  0  0
    #> [226]  0  0  0  0  0  0  1  1  0  0  0  0  0  0  0  1  0  0  1  1  1  0  0  1  0
    #> [251] NA  1  0  1  0  0  0  0  0  1  1  1  0  1  0  1  0  0  0  0  1  0  0  0  0
    #> [276]  0  0  0  0  0  0  1  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  1  1  0
    #> [301]  0  1  1  1  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  1  0
    #> [326]  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  1  0  1  0  1
    #> [351]  1  1  0  0  0  1  0  0  0  0  1  1  0  0  0  1  1  0  0  0  0  0  0  0  0
    #> [376]  1  0  0  0  0  0  1  1  0  0  0  1  1  0  1  0  1  0  0  0  0  1  0  0  0
    #> [401]  1  0  0  1  0  0  0  1  0  0  1  0  0  1  0  1  0  0  0  0  0  0  0  0  0
    #> [426]  0  1  1  0  1  0  0  0  0  1  0  0  0  0  0  0  1  1  0  0  1  0  1  1  0
    #> [451]  0  1  1  0  0  0  0  0  1  0  0  0  0  0  1  1  0  0  0  0  0  1  0  1  0
    #> [476]  0  0  0  1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0

#### Cardiorespiratory fitness definition score

The `get_binary()` function computes a binary score (0 = incorrect answer, 1 = correct answer) for a response to a questionnaire item based on the value(s) set as answer(s) to the item.

    capl_demo_data$crf_means_score <- get_binary_score(
      capl_demo_data$crf_means,
      c(2, "How well the heart can pump blood and the lungs can provide oxygen")
    )

    capl_demo_data$crf_means_score
    #>   [1]  0  0  0  1  1  0  1  0  0  0  1  1  0  0  0  1  0  0  0  0  0  1  0  0  0
    #>  [26]  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0
    #>  [51]  0  0  0  1  0  1  1  1  0  0  0  0  0  0  1  0  0  0  1  1  0  1  1  0  1
    #>  [76]  0  0  0  0  0  1  1  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  1
    #> [101]  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  1  0  1  0  0  0  0  0  0
    #> [126]  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  1  1  0  1  1  0  0  0  0  1
    #> [151]  0  0  0  1  0  1  0  0  0  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0
    #> [176]  0  0  1  1  0  0  0  0  0  0  0  1  1  0  0  0  1  1  1  0  0  0  1  0  0
    #> [201]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  1  0
    #> [226]  0  1  0  1  1  0  0  0  0  1  1  0  0  0  0  1  0  0  0  0  0  0  0  0  1
    #> [251]  0  0  0  0  0  0  0  1  0  1  0  0  0  1  0  0  0  0  0  0  0  0  0  1  0
    #> [276]  0  1  1  0  1  0  0  0  0  0  0  0  0  0  0  1  1  0  1  0  0  1  0  0  0
    #> [301]  1  1  0  1  1  0  1  0  0  1  0  0  0  0  1  0  0  1  0  0  1  0  0  0  0
    #> [326]  0  1  0  0  1  0  0  0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    #> [351]  0  0  0  0  0  1  0  1  0  0  0  0  1  0  0  0  0  0  0  1  0  0  0  1  1
    #> [376]  1  0  0  1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0
    #> [401]  0  0  0  0  0  0  0  1  0  1  1  0  1  1  0  0  0  0  0  1  0  1  0  0  1
    #> [426]  1  0  0  0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  1
    #> [451]  0  0  1  1  0  0  1  1  0  0  0  0  1  1  1  0  0  0  1  0  0  0  0  1  0
    #> [476]  0  0  0  1  1  1  0  0  0  0  0  0  0  1  0  0  1  0 NA  0  1  0  0  0  0

#### Muscular strength definition score

The `get_binary()` function computes a binary score (0 = incorrect answer, 1 = correct answer) for a response to a questionnaire item based on the value(s) set as answer(s) to the item.

    capl_demo_data$ms_means_score <- get_binary_score(
      capl_demo_data$ms_means,
      c(1, "How well the muscles can push, pull or stretch")
    )

    capl_demo_data$ms_means_score
    #>   [1]  0  0  1  0  0  1  1  0  0  0  1  1  1  0  1  0  0  0  0  0  0  0  0  0  0
    #>  [26]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  1  0  0  0  0  0
    #>  [51]  0  1  1  0  1  0  1  1  0  1  0  0  0  0  1  1  1  1  0  1  1  1  0  1  0
    #>  [76]  0  0  0  0  0  0  0  1  0  0  0  0  1  0  0  1  0  1  0  1  0  0  0  0  0
    #> [101]  1  0  0  0  0  0  0  0  0  0  1  0  0  1  0  1  1  0  0  0  1  1  1  0  0
    #> [126]  0  0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0
    #> [151]  0  0  0  1  0  1  0  0  1  1  0  0  1  0  0  1  1  0  0  0  0  0  0  1  1
    #> [176]  1  0  0  0  0  1  1  0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    #> [201]  0  0  0  0  0  0  0  0  1  0  0  0  0  0  1 NA  0  0  0  0  0  1  0  1  0
    #> [226]  0  0  1  0  0  1  0  1  0  0  0  1  0  0  0  1  1  0  0  1  0  1  0  0  0
    #> [251]  0  0  0  1  0  0  0  1  1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0
    #> [276]  1  0  0  0  1  0  0  0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    #> [301]  0  0  0  0  0  0  1  0  0  0  1  1  0  0  1  0  0  0  0  1  1  0  0  0  0
    #> [326]  0  0  0  0  0  1  0  1  0  1  1  0  1  0  0  0  1  0  1  0  0  1  0  0  0
    #> [351]  0  0  1  0  0  1  0  1  0  1  0  0  1  1  0  1  0  0  1  0  0  0  0  0  0
    #> [376]  0  0  0  0  0  1  0  0  0  0  1  0  0  1  0  0  0  0  0  0  0  0  1  0  0
    #> [401]  0  0  0  0  0  0  0  1  1  1  0  1 NA  0  0  0  1  1  0  0  0  0  1  0  0
    #> [426]  0  1  1  0  0  1  0  0  0  1  0  0  1  0  1  0  1  0  0  0  0  0  0  0  0
    #> [451]  1  0  1  0  0  0  0  0  1  0  1  1  0  0  1  1  0  1  0  0  1  1  1  0  0
    #> [476]  0  0  0  0  1  1  0  0  1  1  1  0  0  1  0  0  0  0  0  0  0  0  1  1  0

#### Sports skill score

The `get_binary()` function computes a binary score (0 = incorrect answer, 1 = correct answer) for a response to a questionnaire item based on the value(s) set as answer(s) to the item.

    capl_demo_data$sports_skill_score <- get_binary_score(
      capl_demo_data$sports_skill,
      c(4, "Watch a video, take a lesson or have a coach teach you how to kick and catch")
    )

    capl_demo_data$sports_skill_score
    #>   [1] 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0
    #>  [38] 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0
    #>  [75] 1 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 0
    #> [112] 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0
    #> [149] 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0
    #> [186] 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0
    #> [223] 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1
    #> [260] 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0
    #> [297] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1
    #> [334] 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    #> [371] 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1
    #> [408] 1 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0
    #> [445] 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1
    #> [482] 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1

#### Fill in the blanks score

The `get_fill_in_the_blanks_score()` function computes a score that ranges from zero to five for responses to the fill in the blanks items (story about Sally) in the CAPL-2 Questionnaire. This score is used to compute the knowledge and understanding domain score.

    capl_demo_data$fill_in_the_blanks_score <- get_fill_in_the_blanks_score(
      pa_is = capl_demo_data$pa_is,
      pa_is_also = capl_demo_data$pa_is_also,
      improve = capl_demo_data$improve,
      increase = capl_demo_data$increase,
      when_cooling_down = capl_demo_data$when_cooling_down,
      heart_rate = capl_demo_data$heart_rate
    )

    capl_demo_data$fill_in_the_blanks_score
    #>   [1] 1 5 2 5 5 3 3 3 3 4 5 4 3 4 4 3 2 2 3 4 3 3 4 1 5 4 6 4 4 4 4 4 1 4 4 2 4
    #>  [38] 4 3 5 4 3 4 3 5 5 4 5 2 3 4 4 2 3 6 3 3 5 5 2 6 2 2 4 2 4 3 3 6 2 3 5 5 3
    #>  [75] 3 2 5 2 3 3 5 4 4 4 5 5 2 3 4 3 4 5 3 1 5 5 5 4 4 4 5 3 4 2 0 3 3 4 4 3 3
    #> [112] 5 3 4 4 2 2 3 6 4 3 5 5 2 3 3 5 5 3 6 4 3 2 3 3 0 3 4 3 3 3 3 4 3 3 2 5 5
    #> [149] 4 5 4 3 3 5 0 3 3 4 4 2 2 3 4 1 3 3 2 3 6 3 4 4 4 6 2 4 2 3 2 5 4 3 2 5 5
    #> [186] 5 3 2 5 3 3 3 3 5 6 2 4 4 3 4 4 2 5 2 4 3 4 4 1 4 3 5 4 3 3 4 3 2 0 5 4 4
    #> [223] 4 5 3 6 2 5 4 2 3 3 2 4 3 4 3 2 5 3 3 5 3 3 4 5 0 3 4 4 4 4 1 2 4 4 2 3 1
    #> [260] 3 5 2 3 5 4 1 3 3 3 4 3 3 3 4 3 4 5 0 5 3 3 3 3 5 6 5 3 4 3 3 6 6 2 1 2 2
    #> [297] 3 5 4 4 2 1 1 1 5 2 2 5 4 3 5 4 6 3 5 2 5 3 2 5 4 5 4 4 1 3 4 6 3 3 3 5 5
    #> [334] 2 3 4 3 5 5 4 4 0 4 3 4 3 3 3 4 2 3 2 3 6 5 3 5 2 4 4 5 3 2 4 3 2 3 3 5 2
    #> [371] 3 3 5 6 3 3 2 5 4 4 5 4 5 4 3 2 3 5 3 5 2 4 4 4 3 2 4 3 3 2 4 3 3 3 4 2 3
    #> [408] 5 2 4 3 2 4 3 3 3 3 5 3 3 4 2 4 2 4 4 5 3 3 3 3 6 5 3 4 1 4 4 5 4 2 2 2 3
    #> [445] 2 4 4 4 4 1 4 3 1 5 2 5 2 6 2 6 5 3 4 2 3 4 4 3 4 4 2 3 4 2 3 3 4 3 3 4 5
    #> [482] 6 5 5 6 2 4 4 3 4 2 2 3 1 3 2 3 2 3 2

#### Knowledge and understanding score

The `get_ku_score()` function computes a knowledge and understanding domain score that ranges from zero to 10 based on the physical activity guideline (Q1), cardiorespiratory fitness means (Q2), muscular strength and endurance means (Q3), sports skill (Q4) and fill in the blanks (Q5) scores. If one of the scores is missing or invalid, a weighted domain score will be computed from the other four scores. This score is used to compute the overall physical literacy score.

    capl_demo_data$ku_score <- get_ku_score(
      pa_guideline_score = capl_demo_data$pa_guideline_score,
      crf_means_score = capl_demo_data$crf_means_score,
      ms_means_score = capl_demo_data$ms_means_score,
      sports_skill_score = capl_demo_data$sports_skill_score,
      fill_in_the_blanks_score = capl_demo_data$fill_in_the_blanks_score
    )

    capl_demo_data$ku_score
    #>   [1] 1.000000 7.000000 4.000000 6.000000 6.000000 4.000000 6.000000 3.000000
    #>   [9] 4.000000 4.000000 8.000000 6.000000 4.000000 4.000000 6.000000 4.000000
    #>  [17] 2.000000 3.000000 4.000000 4.000000 3.000000 4.000000 4.000000 1.000000
    #>  [25] 5.000000 5.000000 7.000000 5.000000 5.000000 5.000000 4.000000 5.000000
    #>  [33] 1.000000 5.000000 6.000000 2.000000 4.000000 4.000000 3.000000 6.000000
    #>  [41] 4.000000 3.000000 5.000000 4.000000 6.000000 7.000000 4.000000 7.000000
    #>  [49] 3.000000 3.000000 4.000000 5.000000 3.000000 4.000000 7.000000 4.000000
    #>  [57] 6.000000 7.000000 6.000000 4.000000 6.000000 2.000000 2.000000 4.000000
    #>  [65] 4.000000 5.000000 5.000000 6.000000 8.000000 4.000000 4.000000 7.000000
    #>  [73] 7.000000 4.000000 6.000000 2.000000 5.000000 3.000000 4.000000 5.000000
    #>  [81] 7.000000 5.000000 5.000000 6.000000 5.000000 5.000000 4.000000 5.000000
    #>  [89] 4.000000 4.000000 5.000000 7.000000 5.000000 2.000000 7.000000 6.000000
    #>  [97] 5.000000 5.000000 4.000000 7.000000 7.000000 4.000000 7.000000 4.000000
    #> [105] 1.000000 3.000000 5.000000 4.000000 4.000000 4.000000 4.000000 5.000000
    #> [113] 3.000000 5.000000 5.000000 5.000000 4.000000 3.000000 7.000000 5.000000
    #> [121] 6.000000 8.000000 7.000000 2.000000 4.000000 3.000000 5.000000 7.000000
    #> [129] 3.000000 7.000000 5.000000 3.000000 4.000000 3.000000 3.000000 0.000000
    #> [137] 4.000000 4.000000 4.000000 4.000000 5.000000 4.000000 4.000000 6.000000
    #> [145] 5.000000 4.000000 5.000000 6.000000 4.000000 6.000000 4.000000 3.000000
    #> [153] 3.000000 7.000000 0.000000 5.000000 4.000000 6.000000 5.000000 4.000000
    #> [161] 3.000000 5.000000 7.000000 2.000000 3.000000 4.000000 4.000000 3.000000
    #> [169] 6.000000 4.000000 5.000000 5.000000 4.000000 7.000000 3.000000 6.000000
    #> [177] 3.000000 4.000000 4.000000 5.000000 5.000000 5.000000 3.000000 7.000000
    #> [185] 5.000000 6.000000 4.000000 3.000000 6.000000 3.000000 4.000000 4.000000
    #> [193] 5.000000 6.000000 6.000000 2.000000 4.000000 5.000000 4.000000 5.000000
    #> [201] 4.000000 3.000000 5.000000 2.000000 4.000000 3.000000 5.000000 5.000000
    #> [209] 2.000000 4.000000 3.000000 6.000000 5.000000 3.000000 6.000000 4.444444
    #> [217] 4.000000 2.000000 1.000000 5.000000 4.000000 6.000000 4.000000 8.000000
    #> [225] 3.000000 6.000000 3.000000 6.000000 5.000000 4.000000 4.000000 4.000000
    #> [233] 5.000000 4.000000 4.000000 5.000000 4.000000 2.000000 5.000000 3.000000
    #> [241] 6.000000 6.000000 3.000000 4.000000 6.000000 7.000000 1.000000 3.000000
    #> [249] 5.000000 5.000000 5.555556 5.000000 1.000000 4.000000 4.000000 4.000000
    #> [257] 2.000000 5.000000 3.000000 5.000000 6.000000 4.000000 4.000000 8.000000
    #> [265] 4.000000 2.000000 3.000000 3.000000 3.000000 4.000000 4.000000 3.000000
    #> [273] 4.000000 5.000000 3.000000 5.000000 7.000000 2.000000 6.000000 6.000000
    #> [281] 3.000000 4.000000 3.000000 6.000000 6.000000 7.000000 5.000000 4.000000
    #> [289] 3.000000 3.000000 7.000000 7.000000 3.000000 2.000000 2.000000 2.000000
    #> [297] 4.000000 6.000000 5.000000 4.000000 3.000000 3.000000 2.000000 3.000000
    #> [305] 6.000000 2.000000 5.000000 5.000000 4.000000 4.000000 7.000000 5.000000
    #> [313] 8.000000 3.000000 7.000000 2.000000 5.000000 4.000000 2.000000 6.000000
    #> [321] 7.000000 5.000000 4.000000 6.000000 1.000000 3.000000 6.000000 6.000000
    #> [329] 3.000000 5.000000 4.000000 5.000000 7.000000 3.000000 4.000000 6.000000
    #> [337] 4.000000 6.000000 5.000000 4.000000 5.000000 2.000000 4.000000 5.000000
    #> [345] 4.000000 5.000000 5.000000 4.000000 4.000000 3.000000 4.000000 3.000000
    #> [353] 5.000000 6.000000 5.000000 6.000000 5.000000 4.000000 4.000000 5.000000
    #> [361] 6.000000 4.000000 4.000000 5.000000 3.000000 4.000000 4.000000 4.000000
    #> [369] 6.000000 3.000000 4.000000 3.000000 5.000000 7.000000 5.000000 5.000000
    #> [377] 3.000000 5.000000 5.000000 5.000000 6.000000 5.000000 7.000000 4.000000
    #> [385] 3.000000 3.000000 5.000000 6.000000 4.000000 6.000000 3.000000 5.000000
    #> [393] 4.000000 4.000000 4.000000 3.000000 5.000000 5.000000 3.000000 2.000000
    #> [401] 6.000000 3.000000 3.000000 4.000000 4.000000 2.000000 4.000000 9.000000
    #> [409] 4.000000 6.000000 6.000000 3.000000 5.555556 6.000000 4.000000 4.000000
    #> [417] 4.000000 6.000000 3.000000 4.000000 4.000000 3.000000 5.000000 2.000000
    #> [425] 6.000000 6.000000 7.000000 6.000000 3.000000 5.000000 4.000000 7.000000
    #> [433] 5.000000 3.000000 7.000000 1.000000 4.000000 5.000000 6.000000 5.000000
    #> [441] 3.000000 4.000000 4.000000 3.000000 3.000000 6.000000 6.000000 7.000000
    #> [449] 5.000000 2.000000 5.000000 4.000000 5.000000 7.000000 2.000000 6.000000
    #> [457] 3.000000 7.000000 4.000000 7.000000 6.000000 4.000000 5.000000 3.000000
    #> [465] 6.000000 6.000000 4.000000 4.000000 5.000000 4.000000 3.000000 5.000000
    #> [473] 5.000000 5.000000 3.000000 3.000000 5.000000 3.000000 5.000000 6.000000
    #> [481] 8.000000 6.000000 6.000000 7.000000 7.000000 3.000000 5.000000 4.000000
    #> [489] 5.000000 4.000000 2.000000 3.000000 3.000000 1.111111 3.000000 3.000000
    #> [497] 3.000000 4.000000 4.000000 3.000000

#### Knowledge and understanding interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$ku_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$ku_score,
      protocol = "ku"
    )

    capl_demo_data$ku_interpretation
    #>   [1] "beginning"   "achieving"   "beginning"   "progressing" "progressing"
    #>   [6] "beginning"   "progressing" "beginning"   "beginning"   "beginning"
    #>  [11] NA            "progressing" NA            NA            "progressing"
    #>  [16] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #>  [21] "beginning"   "beginning"   "beginning"   NA            NA
    #>  [26] NA            "progressing" NA            "beginning"   "progressing"
    #>  [31] "beginning"   "beginning"   "beginning"   NA            "progressing"
    #>  [36] NA            NA            "beginning"   "beginning"   "progressing"
    #>  [41] "beginning"   "beginning"   "progressing" "beginning"   "progressing"
    #>  [46] "achieving"   "beginning"   "achieving"   NA            NA
    #>  [51] "beginning"   "beginning"   "beginning"   "beginning"   "achieving"
    #>  [56] "beginning"   "progressing" "achieving"   "progressing" "beginning"
    #>  [61] "progressing" NA            "beginning"   "beginning"   "beginning"
    #>  [66] NA            "progressing" "progressing" NA            "beginning"
    #>  [71] "beginning"   "achieving"   "progressing" "beginning"   NA
    #>  [76] "beginning"   NA            "beginning"   "beginning"   "beginning"
    #>  [81] NA            "progressing" "progressing" "progressing" "beginning"
    #>  [86] NA            "beginning"   "progressing" "beginning"   "beginning"
    #>  [91] "progressing" "progressing" NA            NA            NA
    #>  [96] "progressing" NA            "progressing" "beginning"   "progressing"
    #> [101] "progressing" "beginning"   "progressing" NA            "beginning"
    #> [106] "beginning"   "progressing" "beginning"   "beginning"   "beginning"
    #> [111] "beginning"   "progressing" "beginning"   NA            "progressing"
    #> [116] "progressing" "beginning"   "beginning"   "progressing" "beginning"
    #> [121] NA            "achieving"   "achieving"   "beginning"   "beginning"
    #> [126] NA            "progressing" NA            NA            "progressing"
    #> [131] "progressing" NA            "beginning"   "beginning"   "beginning"
    #> [136] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #> [141] "progressing" "beginning"   "beginning"   "progressing" "beginning"
    #> [146] "beginning"   NA            NA            "beginning"   "progressing"
    #> [151] "beginning"   "beginning"   "beginning"   "progressing" "beginning"
    #> [156] "progressing" "beginning"   "progressing" "progressing" "beginning"
    #> [161] NA            "progressing" "achieving"   "beginning"   NA
    #> [166] "beginning"   "beginning"   NA            "progressing" "beginning"
    #> [171] "beginning"   "beginning"   "beginning"   "progressing" "beginning"
    #> [176] "progressing" "beginning"   NA            NA            "beginning"
    #> [181] "progressing" NA            "beginning"   NA            "beginning"
    #> [186] "progressing" "beginning"   "beginning"   "progressing" NA
    #> [191] "beginning"   "beginning"   "beginning"   "progressing" NA
    #> [196] "beginning"   "beginning"   "progressing" "beginning"   NA
    #> [201] "beginning"   "beginning"   "progressing" "beginning"   "beginning"
    #> [206] "beginning"   "progressing" "beginning"   "beginning"   NA
    #> [211] NA            "progressing" "beginning"   "beginning"   "progressing"
    #> [216] "beginning"   NA            "beginning"   "beginning"   "progressing"
    #> [221] "beginning"   "progressing" NA            NA            "beginning"
    #> [226] "progressing" "beginning"   NA            "progressing" NA
    #> [231] "beginning"   "beginning"   "progressing" "beginning"   "beginning"
    #> [236] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #> [241] "progressing" "progressing" NA            NA            NA
    #> [246] "progressing" "beginning"   NA            NA            "progressing"
    #> [251] NA            "progressing" NA            "beginning"   "beginning"
    #> [256] "beginning"   "beginning"   "beginning"   "beginning"   NA
    #> [261] "progressing" "beginning"   "beginning"   "excelling"   "beginning"
    #> [266] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #> [271] "beginning"   "beginning"   NA            "beginning"   "beginning"
    #> [276] "progressing" "progressing" "beginning"   "progressing" "progressing"
    #> [281] "beginning"   NA            "beginning"   "progressing" "progressing"
    #> [286] "achieving"   "progressing" "beginning"   "beginning"   "beginning"
    #> [291] "progressing" "progressing" "beginning"   "beginning"   NA
    #> [296] "beginning"   "beginning"   "progressing" "progressing" "beginning"
    #> [301] "beginning"   "beginning"   "beginning"   "beginning"   "progressing"
    #> [306] "beginning"   "progressing" NA            NA            "beginning"
    #> [311] "achieving"   "beginning"   "achieving"   "beginning"   "progressing"
    #> [316] "beginning"   "beginning"   "beginning"   "beginning"   NA
    #> [321] "progressing" "progressing" "beginning"   "progressing" "beginning"
    #> [326] NA            "progressing" "progressing" "beginning"   "progressing"
    #> [331] "beginning"   "progressing" "progressing" "beginning"   "beginning"
    #> [336] "progressing" "beginning"   "progressing" "beginning"   "beginning"
    #> [341] NA            NA            "beginning"   "beginning"   "beginning"
    #> [346] "beginning"   "progressing" "beginning"   "beginning"   "beginning"
    #> [351] NA            NA            "beginning"   "progressing" "beginning"
    #> [356] "progressing" NA            "beginning"   "beginning"   "progressing"
    #> [361] NA            "beginning"   NA            "progressing" "beginning"
    #> [366] "beginning"   "beginning"   "beginning"   "progressing" "beginning"
    #> [371] "beginning"   "beginning"   "progressing" NA            "beginning"
    #> [376] "progressing" "beginning"   NA            NA            "beginning"
    #> [381] "progressing" "beginning"   "progressing" "beginning"   "beginning"
    #> [386] "beginning"   "progressing" NA            "beginning"   "progressing"
    #> [391] "beginning"   "progressing" NA            "beginning"   "beginning"
    #> [396] "beginning"   "beginning"   NA            "beginning"   "beginning"
    #> [401] NA            "beginning"   "beginning"   "beginning"   "beginning"
    #> [406] "beginning"   NA            "excelling"   "beginning"   "progressing"
    #> [411] NA            "beginning"   "progressing" "progressing" "beginning"
    #> [416] "beginning"   "beginning"   "progressing" "beginning"   NA
    #> [421] "beginning"   "beginning"   "progressing" "beginning"   "progressing"
    #> [426] "progressing" "progressing" "progressing" "beginning"   "beginning"
    #> [431] "beginning"   "progressing" "beginning"   NA            "progressing"
    #> [436] "beginning"   "beginning"   "progressing" "progressing" "beginning"
    #> [441] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #> [446] "progressing" "progressing" "achieving"   "beginning"   NA
    #> [451] "beginning"   "beginning"   NA            "achieving"   "beginning"
    #> [456] "progressing" "beginning"   "progressing" "beginning"   "progressing"
    #> [461] NA            "beginning"   "beginning"   "beginning"   NA
    #> [466] "progressing" "beginning"   NA            NA            NA
    #> [471] "beginning"   "beginning"   NA            "beginning"   "beginning"
    #> [476] "beginning"   NA            "beginning"   "progressing" "progressing"
    #> [481] NA            "progressing" "progressing" NA            "progressing"
    #> [486] NA            "beginning"   NA            "beginning"   "beginning"
    #> [491] "beginning"   "beginning"   "beginning"   "beginning"   "beginning"
    #> [496] "beginning"   NA            NA            "beginning"   "beginning"

#### Knowledge and understanding domain status

The `get_capl_domain_status()` function computes the status (“complete”, “missing interpretation”, “missing protocol” or “incomplete”) of a CAPL domain.

    capl_demo_data$ku_status <- get_capl_domain_status(
      x = capl_demo_data,
      domain = "ku"
    )

    capl_demo_data$ku_status
    #>   [1] "complete"               "complete"               "complete"
    #>   [4] "complete"               "complete"               "complete"
    #>   [7] "complete"               "complete"               "complete"
    #>  [10] "complete"               "missing interpretation" "complete"
    #>  [13] "missing interpretation" "missing interpretation" "complete"
    #>  [16] "complete"               "complete"               "complete"
    #>  [19] "complete"               "complete"               "complete"
    #>  [22] "complete"               "complete"               "missing interpretation"
    #>  [25] "missing interpretation" "missing interpretation" "complete"
    #>  [28] "missing interpretation" "complete"               "complete"
    #>  [31] "complete"               "complete"               "complete"
    #>  [34] "missing interpretation" "complete"               "missing interpretation"
    #>  [37] "missing interpretation" "complete"               "complete"
    #>  [40] "complete"               "complete"               "complete"
    #>  [43] "complete"               "complete"               "complete"
    #>  [46] "complete"               "complete"               "complete"
    #>  [49] "missing interpretation" "missing interpretation" "complete"
    #>  [52] "complete"               "complete"               "complete"
    #>  [55] "complete"               "complete"               "complete"
    #>  [58] "complete"               "complete"               "complete"
    #>  [61] "complete"               "missing interpretation" "complete"
    #>  [64] "complete"               "complete"               "missing interpretation"
    #>  [67] "complete"               "complete"               "missing interpretation"
    #>  [70] "complete"               "complete"               "complete"
    #>  [73] "complete"               "complete"               "missing interpretation"
    #>  [76] "complete"               "missing interpretation" "complete"
    #>  [79] "complete"               "complete"               "missing interpretation"
    #>  [82] "complete"               "complete"               "complete"
    #>  [85] "complete"               "missing interpretation" "complete"
    #>  [88] "complete"               "complete"               "complete"
    #>  [91] "complete"               "complete"               "missing interpretation"
    #>  [94] "missing interpretation" "missing interpretation" "complete"
    #>  [97] "missing interpretation" "complete"               "complete"
    #> [100] "complete"               "complete"               "complete"
    #> [103] "complete"               "missing interpretation" "complete"
    #> [106] "complete"               "complete"               "complete"
    #> [109] "complete"               "complete"               "complete"
    #> [112] "complete"               "complete"               "missing interpretation"
    #> [115] "complete"               "complete"               "complete"
    #> [118] "complete"               "complete"               "complete"
    #> [121] "missing interpretation" "complete"               "complete"
    #> [124] "complete"               "complete"               "missing interpretation"
    #> [127] "complete"               "missing interpretation" "missing interpretation"
    #> [130] "complete"               "complete"               "missing interpretation"
    #> [133] "complete"               "complete"               "complete"
    #> [136] "complete"               "complete"               "complete"
    #> [139] "complete"               "complete"               "complete"
    #> [142] "complete"               "complete"               "complete"
    #> [145] "complete"               "complete"               "missing interpretation"
    #> [148] "missing interpretation" "complete"               "complete"
    #> [151] "complete"               "complete"               "complete"
    #> [154] "complete"               "complete"               "complete"
    #> [157] "complete"               "complete"               "complete"
    #> [160] "complete"               "missing interpretation" "complete"
    #> [163] "complete"               "complete"               "missing interpretation"
    #> [166] "complete"               "complete"               "missing interpretation"
    #> [169] "complete"               "complete"               "complete"
    #> [172] "complete"               "complete"               "complete"
    #> [175] "complete"               "complete"               "complete"
    #> [178] "missing interpretation" "missing interpretation" "complete"
    #> [181] "complete"               "missing interpretation" "complete"
    #> [184] "missing interpretation" "complete"               "complete"
    #> [187] "complete"               "complete"               "complete"
    #> [190] "missing interpretation" "complete"               "complete"
    #> [193] "complete"               "complete"               "missing interpretation"
    #> [196] "complete"               "complete"               "complete"
    #> [199] "complete"               "missing interpretation" "complete"
    #> [202] "complete"               "complete"               "complete"
    #> [205] "complete"               "complete"               "complete"
    #> [208] "complete"               "complete"               "missing interpretation"
    #> [211] "missing interpretation" "complete"               "complete"
    #> [214] "complete"               "complete"               "missing protocol"
    #> [217] "missing interpretation" "complete"               "complete"
    #> [220] "complete"               "complete"               "complete"
    #> [223] "missing interpretation" "missing interpretation" "complete"
    #> [226] "complete"               "complete"               "missing interpretation"
    #> [229] "complete"               "missing interpretation" "complete"
    #> [232] "complete"               "complete"               "complete"
    #> [235] "complete"               "complete"               "complete"
    #> [238] "complete"               "complete"               "complete"
    #> [241] "complete"               "complete"               "missing interpretation"
    #> [244] "missing interpretation" "missing interpretation" "complete"
    #> [247] "complete"               "missing interpretation" "missing interpretation"
    #> [250] "complete"               "missing interpretation" "complete"
    #> [253] "missing interpretation" "complete"               "complete"
    #> [256] "complete"               "complete"               "complete"
    #> [259] "complete"               "missing interpretation" "complete"
    #> [262] "complete"               "complete"               "complete"
    #> [265] "complete"               "complete"               "complete"
    #> [268] "complete"               "complete"               "complete"
    #> [271] "complete"               "complete"               "missing interpretation"
    #> [274] "complete"               "complete"               "complete"
    #> [277] "complete"               "complete"               "complete"
    #> [280] "complete"               "complete"               "missing interpretation"
    #> [283] "complete"               "complete"               "complete"
    #> [286] "complete"               "complete"               "complete"
    #> [289] "complete"               "complete"               "complete"
    #> [292] "complete"               "complete"               "complete"
    #> [295] "missing interpretation" "complete"               "complete"
    #> [298] "complete"               "complete"               "complete"
    #> [301] "complete"               "complete"               "complete"
    #> [304] "complete"               "complete"               "complete"
    #> [307] "complete"               "missing interpretation" "missing interpretation"
    #> [310] "complete"               "complete"               "complete"
    #> [313] "complete"               "complete"               "complete"
    #> [316] "complete"               "complete"               "complete"
    #> [319] "complete"               "missing interpretation" "complete"
    #> [322] "complete"               "complete"               "complete"
    #> [325] "complete"               "missing interpretation" "complete"
    #> [328] "complete"               "complete"               "complete"
    #> [331] "complete"               "complete"               "complete"
    #> [334] "complete"               "complete"               "complete"
    #> [337] "complete"               "complete"               "complete"
    #> [340] "complete"               "missing interpretation" "missing interpretation"
    #> [343] "complete"               "complete"               "complete"
    #> [346] "complete"               "complete"               "complete"
    #> [349] "complete"               "complete"               "missing interpretation"
    #> [352] "missing interpretation" "complete"               "complete"
    #> [355] "complete"               "complete"               "missing interpretation"
    #> [358] "complete"               "complete"               "complete"
    #> [361] "missing interpretation" "complete"               "missing interpretation"
    #> [364] "complete"               "complete"               "complete"
    #> [367] "complete"               "complete"               "complete"
    #> [370] "complete"               "complete"               "complete"
    #> [373] "complete"               "missing interpretation" "complete"
    #> [376] "complete"               "complete"               "missing interpretation"
    #> [379] "missing interpretation" "complete"               "complete"
    #> [382] "complete"               "complete"               "complete"
    #> [385] "complete"               "complete"               "complete"
    #> [388] "missing interpretation" "complete"               "complete"
    #> [391] "complete"               "complete"               "missing interpretation"
    #> [394] "complete"               "complete"               "complete"
    #> [397] "complete"               "missing interpretation" "complete"
    #> [400] "complete"               "missing interpretation" "complete"
    #> [403] "complete"               "complete"               "complete"
    #> [406] "complete"               "missing interpretation" "complete"
    #> [409] "complete"               "complete"               "missing interpretation"
    #> [412] "complete"               "missing protocol"       "complete"
    #> [415] "complete"               "complete"               "complete"
    #> [418] "complete"               "complete"               "missing interpretation"
    #> [421] "complete"               "complete"               "complete"
    #> [424] "complete"               "complete"               "complete"
    #> [427] "complete"               "complete"               "complete"
    #> [430] "complete"               "complete"               "complete"
    #> [433] "complete"               "missing interpretation" "complete"
    #> [436] "complete"               "complete"               "complete"
    #> [439] "complete"               "complete"               "complete"
    #> [442] "complete"               "complete"               "complete"
    #> [445] "complete"               "complete"               "complete"
    #> [448] "complete"               "complete"               "missing interpretation"
    #> [451] "complete"               "complete"               "missing interpretation"
    #> [454] "complete"               "complete"               "complete"
    #> [457] "complete"               "complete"               "complete"
    #> [460] "complete"               "missing interpretation" "complete"
    #> [463] "complete"               "complete"               "missing interpretation"
    #> [466] "complete"               "complete"               "missing interpretation"
    #> [469] "missing interpretation" "missing interpretation" "complete"
    #> [472] "complete"               "missing interpretation" "complete"
    #> [475] "complete"               "complete"               "missing interpretation"
    #> [478] "complete"               "complete"               "complete"
    #> [481] "missing interpretation" "complete"               "complete"
    #> [484] "missing interpretation" "complete"               "missing interpretation"
    #> [487] "complete"               "missing interpretation" "complete"
    #> [490] "complete"               "complete"               "complete"
    #> [493] "complete"               "missing protocol"       "complete"
    #> [496] "complete"               "missing interpretation" "missing interpretation"
    #> [499] "complete"               "complete"

### Overall physical literacy functions

As illustrated in the CAPL-2 manual on page 17, the formula for computing the overall physical literacy score is:

#### Overall physical literacy score

The `get_capl_score()` function computes an overall physical literacy score that ranges from zero to 100 based on the physical competence, daily behaviour, motivation and confidence, and knowledge and understanding domain scores. If one of the scores is missing or invalid, a weighted score will be computed from the other three scores.

    capl_demo_data$capl_score <- get_capl_score(
      pc_score = capl_demo_data$pc_score,
      db_score = capl_demo_data$db_score,
      mc_score = capl_demo_data$mc_score,
      ku_score = capl_demo_data$ku_score
    )

    capl_demo_data$capl_score
    #>   [1] 54.28571 76.90000 60.00000 68.80000 79.00000 63.00000 52.00000 71.26667
    #>   [9] 58.40000 74.66667 83.14286 67.90000 67.50000 64.10000 54.85714 83.60000
    #>  [17] 74.60000 77.10000 68.40000 78.80000 75.00000 71.40000 70.83333 64.42857
    #>  [25] 68.10000 80.46667 83.30000 68.20000 79.10000 71.30000 65.60000 51.50000
    #>  [33] 65.60000 69.23333 79.33333 75.40000 74.20000 80.00000 77.10000 61.10000
    #>  [41] 69.30000 81.50000 68.00000 84.50000 81.42857 73.00000 52.00000 86.38095
    #>  [49] 64.30000 68.93333 70.10000 83.33333 74.40000 75.50000 79.86667 82.30000
    #>  [57] 62.90000 79.20000 86.13333 71.70000 82.50000 67.80000 59.50000 68.14286
    #>  [65] 65.80000 79.40000 32.90000 76.30000 71.60000 64.14286 73.04762 67.70000
    #>  [73] 71.20000 69.71429 67.50000 75.60000 69.40000 47.40000 60.00000 51.28571
    #>  [81] 76.80000 78.20000 71.20000 69.10000 65.30000 74.76667 78.00000 88.57143
    #>  [89] 69.90000 58.10000 62.10000 81.30000 74.00000 74.90000 51.60000 75.26667
    #>  [97] 76.50000 67.90000 77.30000 77.42857 77.40000 77.30000 67.50000 79.30000
    #> [105] 61.30000 52.40000 65.36667 78.10000       NA 59.70000 81.80000 61.16667
    #> [113] 82.40000 81.20000 55.40000 72.14286 75.10000 71.20000 68.60000 61.60000
    #> [121] 76.00000 85.90000 72.85714 69.60000 72.20000 75.40000 67.80000 78.70000
    #> [129] 65.93333 66.00000 68.96667 78.00000 74.80000 61.13333 63.50000 80.10000
    #> [137] 76.83333 60.00000 73.50000 65.90000 61.42857 83.10000 65.71429 79.00000
    #> [145] 64.90000 54.80000 76.40000 87.20000 54.95238 71.90000 60.90000 68.60000
    #> [153] 76.90000 68.20000 57.40000 83.90000 64.90000 73.70000 69.90000 75.71429
    #> [161] 73.70000 67.40000 78.30000 52.20000 62.90000 70.70000 82.13333 67.40000
    #> [169] 59.33333 73.00000 81.00000 67.06667 57.90000 82.85714 82.70000 64.28571
    #> [177] 81.60000 83.90000 76.00000 68.60000 56.70000 57.60000 72.80000 81.80000
    #> [185] 80.90000 75.70000 84.20000 81.93333 74.70000 76.60000 69.80000 61.00000
    #> [193] 62.60000 61.60000 78.60000 57.85714 73.06667 63.70000 74.33333 63.70000
    #> [201] 38.70000 46.20000 60.90000 69.20000 82.90000 63.23333 79.90000 67.90000
    #> [209] 70.00000 62.40000 79.50000 64.50000 77.20000 79.86667 74.86667 70.92063
    #> [217] 70.40000 58.80000 73.30000 72.60000 71.00000 66.80000 55.85714 87.00000
    #> [225] 62.00000 84.20000 78.86667 73.20000 64.00000 70.10000 54.66667 59.20000
    #> [233] 65.90000       NA 82.40000 72.60000 57.13333 60.38095 73.00000 74.46667
    #> [241] 77.30000 63.30000 68.30000 77.00000 78.90000 86.90000 61.30000 76.66667
    #> [249] 73.42857 77.80000 63.25556 56.73333 66.40000 81.50000 65.71429 88.57143
    #> [257] 75.00000 68.20000 72.57143 79.50000 85.10000 69.10000 67.20000 75.57143
    #> [265] 74.53333 60.10000 61.40000 76.00000 78.20000 70.70000 63.96667 65.66667
    #> [273] 84.46667 72.30000 63.40000 70.80000 71.80000 72.90000 84.10000 79.90000
    #> [281] 71.33333 60.90000 67.10000 78.60000 78.60000 86.06667 79.70000 61.60000
    #> [289] 69.73333 77.06667 74.00000 75.71429 56.20000 74.06667 68.70000 63.26667
    #> [297] 76.53333 63.86667 74.10000 81.40000 64.50000 75.83333 69.20000 72.53333
    #> [305] 82.40000 71.80952 83.80000 77.53333 77.14286 77.20000 74.90000 71.40000
    #> [313] 80.00000 69.60000 64.40000 64.60000 77.00000 81.30000 68.90000 76.20000
    #> [321] 82.70000 73.90000 71.33333 77.70000 76.90000 65.90000 62.63333 48.60000
    #> [329] 60.20000 78.60000 69.50000 76.30000 66.60000 74.20000 78.10000 65.70000
    #> [337] 53.70000 78.00000 70.70000 68.42857 58.60000 78.40000 74.00000 67.46667
    #> [345] 68.70000 78.30000 78.80000 62.70000 52.71429 79.40000 61.53333 75.50000
    #> [353] 71.42857 80.90000 74.70000 69.60000 74.60000 85.40000 76.80000 79.13333
    #> [361] 78.20000 82.60000 53.40000 78.43333 78.50000 75.70000 66.00000 63.46667
    #> [369]       NA 82.30000 69.10000 67.50000 52.50000 80.10000 66.90000 73.70000
    #> [377] 70.60000 76.85714 65.10000 74.70000 76.10000 71.60000 83.06667 80.70000
    #> [385] 66.95238 79.70000 80.60000 64.42857 59.50000 66.00000 74.60000 81.70000
    #> [393] 75.50000 81.33333 81.60000 59.85714 67.70000 72.00000 65.30000 70.00000
    #> [401] 66.80000 70.20000 79.90000 80.70000 77.13333 60.20000 83.90000 83.70000
    #> [409] 81.20000 83.00000 80.50000 66.85714 69.35556 66.40000 78.90000 65.30000
    #> [417] 75.80000 61.46667 76.90000 76.40000 66.00000 54.10000 61.40000 66.46667
    #> [425] 48.10000 86.40000 67.00000 73.80000 82.20000 74.46667 64.83333 81.85714
    #> [433] 65.50000 76.80000 82.30000 73.90000 72.30000 80.60000 84.93333 63.90000
    #> [441] 64.28571 69.57143 51.40000 77.40000 64.00000 78.80000 78.80000 63.30000
    #> [449] 83.80000 55.04762 77.60000 64.40000 66.71429 90.00000 58.60000 77.53333
    #> [457] 63.10000 88.10000 70.90000 69.50000 61.90000 71.30000 81.80000 65.40000
    #> [465] 67.70000 39.10000 55.50000 60.80000 63.85714 61.93333 58.43333 81.60000
    #> [473] 81.00000 79.42857 68.40000 49.33333 58.60000 77.13333 73.80000 71.00000
    #> [481] 86.50000 72.80000 71.57143 73.40000 77.53333 70.14286 69.60000 64.30000
    #> [489] 78.70000 68.20000 66.86667 57.20000 71.40000 78.11111 63.73333 57.14286
    #> [497] 68.42857 62.80000 71.60000 49.42857

#### Overall physical literacy interpretation

The `get_capl_interpretation()` function computes an age- and gender-specific CAPL-2 interpretation for a given CAPL-2 protocol or domain score.

    capl_demo_data$capl_interpretation <- get_capl_interpretation(
      age = capl_demo_data$age,
      gender = capl_demo_data$gender,
      score = capl_demo_data$capl_score,
      protocol = "capl"
    )

    capl_demo_data$capl_interpretation
    #>   [1] "progressing" "excelling"   "progressing" "achieving"   "achieving"
    #>   [6] "progressing" "beginning"   "achieving"   "progressing" "excelling"
    #>  [11] NA            "progressing" NA            NA            "progressing"
    #>  [16] "excelling"   "achieving"   "excelling"   "progressing" "excelling"
    #>  [21] "achieving"   "achieving"   "achieving"   NA            NA
    #>  [26] NA            "excelling"   NA            "excelling"   "achieving"
    #>  [31] "progressing" "progressing" "progressing" NA            "excelling"
    #>  [36] NA            NA            "excelling"   "excelling"   "progressing"
    #>  [41] "achieving"   "excelling"   "achieving"   "excelling"   "excelling"
    #>  [46] "achieving"   "progressing" "excelling"   NA            NA
    #>  [51] "achieving"   "excelling"   "excelling"   "achieving"   "excelling"
    #>  [56] "excelling"   "progressing" "excelling"   "excelling"   "achieving"
    #>  [61] "excelling"   NA            "progressing" "achieving"   "achieving"
    #>  [66] NA            "beginning"   "excelling"   NA            "progressing"
    #>  [71] "excelling"   "achieving"   "achieving"   "achieving"   NA
    #>  [76] "excelling"   NA            "beginning"   "progressing" "progressing"
    #>  [81] NA            "excelling"   "achieving"   "progressing" "progressing"
    #>  [86] NA            "excelling"   "excelling"   "achieving"   "progressing"
    #>  [91] "progressing" "excelling"   NA            NA            NA
    #>  [96] "achieving"   NA            "achieving"   "excelling"   "excelling"
    #> [101] "excelling"   "excelling"   "progressing" NA            "progressing"
    #> [106] "progressing" "progressing" "excelling"   NA            "progressing"
    #> [111] "excelling"   "progressing" "excelling"   NA            "progressing"
    #> [116] "achieving"   "excelling"   "achieving"   "progressing" "progressing"
    #> [121] NA            "excelling"   "achieving"   "achieving"   "achieving"
    #> [126] NA            "achieving"   NA            NA            "progressing"
    #> [131] "achieving"   NA            "achieving"   "progressing" "progressing"
    #> [136] "excelling"   "excelling"   "progressing" "achieving"   "progressing"
    #> [141] "progressing" "excelling"   "progressing" "excelling"   "progressing"
    #> [146] "progressing" NA            NA            "progressing" "achieving"
    #> [151] "progressing" "achieving"   "achieving"   "progressing" "progressing"
    #> [156] "excelling"   "progressing" "achieving"   "achieving"   "excelling"
    #> [161] NA            "progressing" "excelling"   "progressing" NA
    #> [166] "achieving"   "excelling"   NA            "progressing" "achieving"
    #> [171] "excelling"   "achieving"   "progressing" "excelling"   "excelling"
    #> [176] "progressing" "excelling"   NA            NA            "progressing"
    #> [181] "progressing" NA            "achieving"   NA            "excelling"
    #> [186] "excelling"   "excelling"   "excelling"   "excelling"   NA
    #> [191] "achieving"   "progressing" "progressing" "progressing" NA
    #> [196] "progressing" "achieving"   "progressing" "excelling"   NA
    #> [201] "beginning"   "beginning"   "progressing" "achieving"   "excelling"
    #> [206] "progressing" "excelling"   "progressing" "achieving"   NA
    #> [211] NA            "progressing" "excelling"   "excelling"   "excelling"
    #> [216] "achieving"   NA            "progressing" "achieving"   "excelling"
    #> [221] "achieving"   "progressing" NA            NA            "progressing"
    #> [226] "excelling"   "excelling"   NA            "progressing" NA
    #> [231] "progressing" "progressing" "progressing" NA            "excelling"
    #> [236] "achieving"   "progressing" "progressing" "achieving"   "excelling"
    #> [241] "excelling"   "progressing" NA            NA            NA
    #> [246] "excelling"   "progressing" NA            NA            "excelling"
    #> [251] NA            "progressing" NA            "excelling"   "achieving"
    #> [256] "excelling"   "achieving"   "achieving"   "achieving"   NA
    #> [261] "excelling"   "achieving"   "achieving"   "excelling"   "excelling"
    #> [266] "progressing" "progressing" "achieving"   "excelling"   "achieving"
    #> [271] "progressing" "progressing" NA            "achieving"   "progressing"
    #> [276] "achieving"   "achieving"   "achieving"   "excelling"   "excelling"
    #> [281] "achieving"   NA            "progressing" "excelling"   "excelling"
    #> [286] "excelling"   "excelling"   "progressing" "achieving"   "excelling"
    #> [291] "achieving"   "achieving"   "progressing" "achieving"   NA
    #> [296] "progressing" "excelling"   "progressing" "excelling"   "excelling"
    #> [301] "progressing" "achieving"   "progressing" "achieving"   "excelling"
    #> [306] "excelling"   "excelling"   NA            NA            "excelling"
    #> [311] "excelling"   "achieving"   "excelling"   "achieving"   "progressing"
    #> [316] "progressing" "excelling"   "excelling"   "progressing" NA
    #> [321] "excelling"   "excelling"   "achieving"   "excelling"   "excelling"
    #> [326] NA            "progressing" "beginning"   "progressing" "excelling"
    #> [331] "achieving"   "excelling"   "progressing" "achieving"   "excelling"
    #> [336] "progressing" "progressing" "excelling"   "achieving"   "progressing"
    #> [341] NA            NA            "excelling"   "achieving"   "achieving"
    #> [346] "excelling"   "excelling"   "progressing" "progressing" "excelling"
    #> [351] NA            NA            "achieving"   "excelling"   "achieving"
    #> [356] "achieving"   NA            "excelling"   "excelling"   "excelling"
    #> [361] NA            "excelling"   NA            "excelling"   "excelling"
    #> [366] "excelling"   "progressing" "progressing" NA            "excelling"
    #> [371] "achieving"   "achieving"   "progressing" NA            "achieving"
    #> [376] "achieving"   "achieving"   NA            NA            "achieving"
    #> [381] "achieving"   "achieving"   "excelling"   "excelling"   "achieving"
    #> [386] "excelling"   "excelling"   NA            "progressing" "progressing"
    #> [391] "excelling"   "excelling"   NA            "excelling"   "excelling"
    #> [396] "progressing" "achieving"   NA            "progressing" "achieving"
    #> [401] NA            "achieving"   "excelling"   "excelling"   "excelling"
    #> [406] "progressing" NA            "excelling"   "excelling"   "excelling"
    #> [411] NA            "achieving"   "achieving"   "progressing" "achieving"
    #> [416] "progressing" "excelling"   "progressing" "excelling"   NA
    #> [421] "progressing" "progressing" "progressing" "achieving"   "beginning"
    #> [426] "excelling"   "progressing" "excelling"   "excelling"   "achieving"
    #> [431] "progressing" "excelling"   "progressing" NA            "excelling"
    #> [436] "achieving"   "achieving"   "excelling"   "excelling"   "progressing"
    #> [441] "progressing" "achieving"   "progressing" "achieving"   "progressing"
    #> [446] "excelling"   "excelling"   "progressing" "excelling"   NA
    #> [451] "excelling"   "progressing" NA            "excelling"   "progressing"
    #> [456] "achieving"   "progressing" "excelling"   "achieving"   "achieving"
    #> [461] NA            "achieving"   "excelling"   "achieving"   NA
    #> [466] "beginning"   "progressing" NA            NA            NA
    #> [471] "progressing" "excelling"   NA            "excelling"   "achieving"
    #> [476] "beginning"   NA            "excelling"   "achieving"   "progressing"
    #> [481] NA            "excelling"   "achieving"   NA            "excelling"
    #> [486] NA            "achieving"   NA            "achieving"   "progressing"
    #> [491] "progressing" "progressing" "achieving"   "excelling"   "progressing"
    #> [496] "progressing" NA            NA            "achieving"   "beginning"

#### Overall physical literacy domain status

The `get_capl_domain_status()` function computes the status (“complete”, “missing interpretation”, “missing protocol” or “incomplete”) of a CAPL domain.

    capl_demo_data$capl_status <- get_capl_domain_status(
      x = capl_demo_data,
      domain = "capl"
    )

    capl_demo_data$capl_status
    #>   [1] "missing protocol"       "complete"               "complete"
    #>   [4] "complete"               "complete"               "complete"
    #>   [7] "missing protocol"       "complete"               "complete"
    #>  [10] "missing protocol"       "missing interpretation" "complete"
    #>  [13] "missing interpretation" "missing interpretation" "missing protocol"
    #>  [16] "complete"               "complete"               "complete"
    #>  [19] "complete"               "complete"               "complete"
    #>  [22] "complete"               "complete"               "missing interpretation"
    #>  [25] "missing interpretation" "missing interpretation" "complete"
    #>  [28] "missing interpretation" "complete"               "complete"
    #>  [31] "complete"               "complete"               "complete"
    #>  [34] "missing interpretation" "complete"               "missing interpretation"
    #>  [37] "missing interpretation" "missing protocol"       "complete"
    #>  [40] "complete"               "complete"               "complete"
    #>  [43] "complete"               "complete"               "missing protocol"
    #>  [46] "complete"               "complete"               "missing protocol"
    #>  [49] "missing interpretation" "missing interpretation" "complete"
    #>  [52] "complete"               "complete"               "complete"
    #>  [55] "complete"               "complete"               "complete"
    #>  [58] "complete"               "complete"               "complete"
    #>  [61] "complete"               "missing interpretation" "complete"
    #>  [64] "missing protocol"       "complete"               "missing interpretation"
    #>  [67] "complete"               "complete"               "missing interpretation"
    #>  [70] "missing protocol"       "missing protocol"       "complete"
    #>  [73] "complete"               "missing protocol"       "missing interpretation"
    #>  [76] "complete"               "missing interpretation" "complete"
    #>  [79] "complete"               "missing protocol"       "missing interpretation"
    #>  [82] "complete"               "complete"               "complete"
    #>  [85] "complete"               "missing interpretation" "complete"
    #>  [88] "missing protocol"       "complete"               "complete"
    #>  [91] "complete"               "complete"               "missing interpretation"
    #>  [94] "missing interpretation" "missing interpretation" "complete"
    #>  [97] "missing interpretation" "complete"               "complete"
    #> [100] "missing protocol"       "complete"               "complete"
    #> [103] "complete"               "missing interpretation" "complete"
    #> [106] "complete"               "complete"               "complete"
    #> [109] "incomplete"             "complete"               "complete"
    #> [112] "complete"               "complete"               "missing interpretation"
    #> [115] "complete"               "missing protocol"       "complete"
    #> [118] "complete"               "complete"               "complete"
    #> [121] "missing interpretation" "complete"               "missing protocol"
    #> [124] "complete"               "complete"               "missing interpretation"
    #> [127] "complete"               "missing interpretation" "missing interpretation"
    #> [130] "complete"               "complete"               "missing interpretation"
    #> [133] "complete"               "complete"               "complete"
    #> [136] "complete"               "complete"               "complete"
    #> [139] "complete"               "complete"               "missing protocol"
    #> [142] "complete"               "missing protocol"       "complete"
    #> [145] "complete"               "complete"               "missing interpretation"
    #> [148] "missing interpretation" "missing protocol"       "complete"
    #> [151] "complete"               "complete"               "complete"
    #> [154] "complete"               "complete"               "complete"
    #> [157] "complete"               "complete"               "complete"
    #> [160] "missing protocol"       "missing interpretation" "complete"
    #> [163] "complete"               "complete"               "missing interpretation"
    #> [166] "complete"               "complete"               "missing interpretation"
    #> [169] "complete"               "complete"               "complete"
    #> [172] "complete"               "complete"               "missing protocol"
    #> [175] "complete"               "missing protocol"       "complete"
    #> [178] "missing interpretation" "missing interpretation" "complete"
    #> [181] "complete"               "missing interpretation" "complete"
    #> [184] "missing interpretation" "complete"               "complete"
    #> [187] "complete"               "complete"               "complete"
    #> [190] "missing interpretation" "complete"               "complete"
    #> [193] "complete"               "complete"               "missing interpretation"
    #> [196] "missing protocol"       "complete"               "complete"
    #> [199] "complete"               "missing interpretation" "complete"
    #> [202] "complete"               "complete"               "complete"
    #> [205] "complete"               "complete"               "complete"
    #> [208] "complete"               "missing protocol"       "missing interpretation"
    #> [211] "missing interpretation" "complete"               "complete"
    #> [214] "complete"               "complete"               "missing protocol"
    #> [217] "missing interpretation" "complete"               "complete"
    #> [220] "complete"               "complete"               "complete"
    #> [223] "missing interpretation" "missing interpretation" "complete"
    #> [226] "complete"               "complete"               "missing interpretation"
    #> [229] "complete"               "missing interpretation" "missing protocol"
    #> [232] "complete"               "complete"               "incomplete"
    #> [235] "complete"               "complete"               "complete"
    #> [238] "missing protocol"       "complete"               "complete"
    #> [241] "complete"               "complete"               "missing interpretation"
    #> [244] "missing interpretation" "missing interpretation" "complete"
    #> [247] "complete"               "missing interpretation" "missing interpretation"
    #> [250] "complete"               "missing interpretation" "complete"
    #> [253] "missing interpretation" "complete"               "missing protocol"
    #> [256] "missing protocol"       "complete"               "complete"
    #> [259] "missing protocol"       "missing interpretation" "complete"
    #> [262] "complete"               "complete"               "missing protocol"
    #> [265] "complete"               "complete"               "complete"
    #> [268] "complete"               "complete"               "complete"
    #> [271] "complete"               "complete"               "missing interpretation"
    #> [274] "complete"               "complete"               "complete"
    #> [277] "complete"               "complete"               "complete"
    #> [280] "complete"               "complete"               "missing interpretation"
    #> [283] "complete"               "complete"               "complete"
    #> [286] "complete"               "complete"               "complete"
    #> [289] "complete"               "complete"               "complete"
    #> [292] "missing protocol"       "complete"               "complete"
    #> [295] "missing interpretation" "complete"               "complete"
    #> [298] "complete"               "complete"               "complete"
    #> [301] "complete"               "complete"               "complete"
    #> [304] "complete"               "complete"               "missing protocol"
    #> [307] "complete"               "missing interpretation" "missing interpretation"
    #> [310] "complete"               "complete"               "complete"
    #> [313] "complete"               "complete"               "complete"
    #> [316] "complete"               "complete"               "complete"
    #> [319] "complete"               "missing interpretation" "complete"
    #> [322] "complete"               "missing protocol"       "complete"
    #> [325] "complete"               "missing interpretation" "complete"
    #> [328] "complete"               "complete"               "complete"
    #> [331] "complete"               "complete"               "complete"
    #> [334] "complete"               "complete"               "complete"
    #> [337] "complete"               "complete"               "complete"
    #> [340] "missing protocol"       "missing interpretation" "missing interpretation"
    #> [343] "complete"               "complete"               "complete"
    #> [346] "complete"               "complete"               "complete"
    #> [349] "missing protocol"       "complete"               "missing interpretation"
    #> [352] "missing interpretation" "missing protocol"       "complete"
    #> [355] "complete"               "complete"               "missing interpretation"
    #> [358] "complete"               "complete"               "complete"
    #> [361] "missing interpretation" "complete"               "missing interpretation"
    #> [364] "complete"               "complete"               "complete"
    #> [367] "complete"               "complete"               "incomplete"
    #> [370] "complete"               "complete"               "complete"
    #> [373] "complete"               "missing interpretation" "complete"
    #> [376] "complete"               "complete"               "missing interpretation"
    #> [379] "missing interpretation" "complete"               "complete"
    #> [382] "complete"               "complete"               "complete"
    #> [385] "missing protocol"       "complete"               "complete"
    #> [388] "missing interpretation" "complete"               "complete"
    #> [391] "complete"               "complete"               "missing interpretation"
    #> [394] "complete"               "complete"               "missing protocol"
    #> [397] "complete"               "missing interpretation" "complete"
    #> [400] "complete"               "missing interpretation" "complete"
    #> [403] "complete"               "complete"               "complete"
    #> [406] "complete"               "missing interpretation" "complete"
    #> [409] "complete"               "missing protocol"       "missing interpretation"
    #> [412] "missing protocol"       "complete"               "complete"
    #> [415] "complete"               "complete"               "complete"
    #> [418] "complete"               "complete"               "missing interpretation"
    #> [421] "complete"               "complete"               "complete"
    #> [424] "complete"               "complete"               "complete"
    #> [427] "complete"               "complete"               "complete"
    #> [430] "complete"               "complete"               "missing protocol"
    #> [433] "complete"               "missing interpretation" "complete"
    #> [436] "complete"               "complete"               "complete"
    #> [439] "complete"               "complete"               "missing protocol"
    #> [442] "missing protocol"       "complete"               "complete"
    #> [445] "missing protocol"       "complete"               "complete"
    #> [448] "complete"               "complete"               "missing interpretation"
    #> [451] "complete"               "complete"               "missing interpretation"
    #> [454] "missing protocol"       "complete"               "complete"
    #> [457] "complete"               "complete"               "complete"
    #> [460] "complete"               "missing interpretation" "complete"
    #> [463] "complete"               "complete"               "missing interpretation"
    #> [466] "complete"               "complete"               "missing interpretation"
    #> [469] "missing interpretation" "missing interpretation" "complete"
    #> [472] "complete"               "missing interpretation" "missing protocol"
    #> [475] "complete"               "complete"               "missing interpretation"
    #> [478] "complete"               "complete"               "complete"
    #> [481] "missing interpretation" "complete"               "missing protocol"
    #> [484] "missing interpretation" "complete"               "missing interpretation"
    #> [487] "complete"               "missing interpretation" "complete"
    #> [490] "complete"               "complete"               "complete"
    #> [493] "complete"               "complete"               "complete"
    #> [496] "missing protocol"       "missing interpretation" "missing interpretation"
    #> [499] "complete"               "missing protocol"

## Data visualization

The `capl` package makes use of the famous `ggplot2` R package to create custom functions that render beautiful plots for visualizing CAPL-2 results.

### Plots

CAPL-2 scores can be grouped by their associated interpretative categories and visualized in a bar plot by calling the `get_capl_bar_plot()` function. The mean score for each interpretative category appears above each bar.

    get_capl_bar_plot(
      score = capl_results$pc_score,
      interpretation = capl_results$pc_interpretation,
      x_label = "Interpretation",
      y_label = "Physical competence domain score (/30)"
    )

The color palette can be customized by setting the `colors` parameter.

    get_capl_bar_plot(
      score = capl_results$db_score,
      interpretation = capl_results$db_interpretation,
      x_label = "Interpretation",
      y_label = "Daily behaviour domain score (/30)",
      colors = c("#daf7a6", "#ffc300", "#ff5733", "#c70039")
    )

## Export results

If users want to export their data, the `export_capl_data()` function allows them to export their data to Excel or SPSS.

    export_capl_data(
      x = capl_results,
      file_path = "c:/path/to/store/capl-results.xlsx"
    )

    export_capl_data(
      x = capl_results,
      type = "spss",
      file_path = "c:/path/to/store/capl-results.sav"
    )