returns a MOAS data.frame with one row per participant and timepoint (i.e. removes double/triple scan entries). For analyses not intending to use the power of double/triple scans, or for data which will be widened and scanner type/site is not of interest. Only subject timepoints that have several entries (i.e. several scan sites), will be reduced. All timepoints will be retained.

filter_site(
  data,
  site_var = site_name,
  keep = "long",
  tie = "interval",
  site_order = c("ousPrisma", "ousSkyra", "ousAvanto"),
  verbose = TRUE
)

Arguments

data

data extracted from the NOAS

site_var

column name with the site information

keep

A string specifying which data from double/triple scans to keep.

tie

string indicating given a tie in the "long" keep option, what to keep.

site_order

string vector of the scanner priority given a tie between scanners

verbose

logical, TRUE sets it to verbose

Value

A NOAS type file with one line per subject and timepoint.

Details

Available options for 'keep' are:

  • "long"keep data from scanner with most data (default)

  • "ousAvanto"keep 'ousAvanto'

  • "ousSkyra"keep 'ousSkyra'

  • "ousPrisma"'ousPrisma'

Available options for 'tie' are:

  • "interval"keep data from scanner with longest data interval (default)

  • "ousAvanto"keep 'ousAvanto'

  • "ousSkyra"keep 'ousSkyra'

  • "ousPrisma"'ousPrisma'

Examples

# attach built-in noas example data to test dt <- noas_example filter_site(dt)
#> Keeping data from scanner with most data from double/triple scanned.
#> # A tibble: 9 x 8 #> subject_id project_id wave_code site_name mri_info_folder visit_age cog #> <chr> <chr> <dbl> <chr> <chr> <dbl> <dbl> #> 1 1000000 MemP 1 ousAvanto 1000000_1 8 16 #> 2 1000000 MemP 2 ousAvanto 1000000_2 10 14 #> 3 1000000 MemP 3 ousSkyra 1000000_4 14 NA #> 4 1000000 MemP 4 ousSkyra 1000000_5 17 15 #> 5 1000000 MemP 5 ousSkyra 1000000_6 20 15 #> 6 1000010 MemC 1 ousSkyra 1000010_1 22 14 #> 7 1000010 MemC 2 ousSkyra 1000010_2 28 13 #> 8 1000010 MemC 3 ousSkyra 1000010_3 33 NA #> 9 1000010 MemC 4 ousSkyra 1000010_4 40 10 #> # … with 1 more variable: sex <chr>
filter_site(dt, 'ousSkyra')
#> Keeping data from scanner with most data from double/triple scanned.
#> # A tibble: 9 x 9 #> subject_id project_id wave_code site_name mri_info_folder visit_age cog #> <chr> <chr> <dbl> <chr> <chr> <dbl> <dbl> #> 1 1000000 MemP 1 ousAvanto 1000000_1 8 16 #> 2 1000000 MemP 2 ousAvanto 1000000_2 10 14 #> 3 1000000 MemP 3 ousAvanto 1000000_3 14 16 #> 4 1000000 MemP 4 ousSkyra 1000000_5 17 15 #> 5 1000000 MemP 5 ousSkyra 1000000_6 20 15 #> 6 1000010 MemC 1 ousSkyra 1000010_1 22 14 #> 7 1000010 MemC 2 ousSkyra 1000010_2 28 13 #> 8 1000010 MemC 3 ousSkyra 1000010_3 33 NA #> 9 1000010 MemC 4 ousSkyra 1000010_4 40 10 #> # … with 2 more variables: sex <chr>, "ousSkyra" <chr>
filter_site(dt, 'ousAvanto')
#> Keeping data from scanner with most data from double/triple scanned.
#> # A tibble: 9 x 9 #> subject_id project_id wave_code site_name mri_info_folder visit_age cog #> <chr> <chr> <dbl> <chr> <chr> <dbl> <dbl> #> 1 1000000 MemP 1 ousAvanto 1000000_1 8 16 #> 2 1000000 MemP 2 ousAvanto 1000000_2 10 14 #> 3 1000000 MemP 3 ousAvanto 1000000_3 14 16 #> 4 1000000 MemP 4 ousSkyra 1000000_5 17 15 #> 5 1000000 MemP 5 ousSkyra 1000000_6 20 15 #> 6 1000010 MemC 1 ousSkyra 1000010_1 22 14 #> 7 1000010 MemC 2 ousSkyra 1000010_2 28 13 #> 8 1000010 MemC 3 ousSkyra 1000010_3 33 NA #> 9 1000010 MemC 4 ousSkyra 1000010_4 40 10 #> # … with 2 more variables: sex <chr>, "ousAvanto" <chr>