Skip to contents

This function extracts specific cognitive measures from a dataset, including immediate and delayed word recall, serial subtraction, and backwards counting, along with household and person identifiers.

Usage

extract(data)

Arguments

data

A dataframe containing the full dataset from which specific variables will be selected.

Value

A dataframe with the following variables:

  • HHID: Household ID.

  • PN: Person number (individual identifier).

  • Immediate and delayed word recall variables (columns starting with "SD182M" and "SD183M").

  • Serial subtraction variables (SD142 to SD146).

  • Backwards counting variables (SD124, SD129).

Details

The function selects key cognitive test results and identifiers from the dataset. It uses dplyr::select() to retrieve:

  • Immediate and delayed word recall variables (those starting with "SD182M" and "SD183M").

  • Serial subtraction results (SD142 to SD146).

  • Backwards counting variables (SD124, SD129).

Examples

# Assuming `cog_data` is a dataframe with the relevant columns
extract(cog_data)
#>      HHID PN SD182M1 SD182M2 SD182M3 SD182M4 SD182M5 SD182M6 SD182M7 SD182M8
#> 1  288941 93      17       9      32      33      99      39       5      23
#> 2  234057 99      53      51      38      67      31      31      64      35
#> 3  224021 72      39      10      25      27      16      58      61      40
#> 4  785284 26      63      23      34      25      62      17      25      58
#> 5  326317  7      12      27      29      38      30      64      62      30
#> 6  465208 42      15      99       5      21       6      60      22      12
#> 7  748794  9      32      63       8      15      53      59      25      31
#> 8  293626 83      52       7      12      51       8      34      32      67
#> 9  669691 36      55      63      13      57      22       4      56      56
#> 10 689448 78       7      27      18      26      22      13      25      30
#>    SD182M9 SD182M10 SD183M1 SD183M2 SD183M3 SD183M4 SD183M5 SD183M6 SD183M7
#> 1       35       21      22      61      23      16      19      19      62
#> 2       14       37      12      30      26      24      25      66      25
#> 3       29        8      20      15      38      32      39      62      16
#> 4       32       61      56      24      56      21      64      57      24
#> 5        7       10      17      59      32      65      26      39      64
#> 6        3       60      56      23       7      11       9       4      11
#> 7       23       52      64      53      27      36       7       1      58
#> 8       64       54      35       7      52      54      34      40      20
#> 9       96       34      40      29       5      56      58      30      40
#> 10      15       10      56      15       6      99      13      30       3
#>    SD183M8 SD183M9 SD183M10 SD142 SD143 SD144 SD145 SD146 SD124 SD129
#> 1       29      67        6    96    86    89    69    69     0     0
#> 2       36      65       67    90    86    76    76    52     0     1
#> 3       62       8        8    97    89    89    76    63     0     0
#> 4       54      56       54    97    90    78    66    50     0     0
#> 5       22      21       32    99    80    78    68    51     1     0
#> 6       59      55       96    98    98    74    79    53     1     1
#> 7       52       2       36    97    89    83    65    59     0     0
#> 8       98      53       55    91    92    83    77    50     1     0
#> 9       20      13       14    94    90    75    76    54     0     1
#> 10      11      56       63    98    90    70    64    57     0     0