This function gets the siteIDs that have at least k label level repetitions. These siteIDs can be used in a datasource to only get data from sites that have enough label repetitions. For example, one could use these siteIDs in conjunction with the ds_basic's site_IDs_to_use argument to only get data from sites that have enough repetitions of each stimulus.

get_siteIDs_with_k_label_repetitions(
  binned_data,
  labels,
  k,
  label_levels = NULL
)

Arguments

binned_data

A string that list a path to a file that has data in binned format, or a data frame of binned_data that is in binned format.

labels

A string specifying which label variable should be used when calculating the minimum number of level repetitions.

k

A number specifying that all sitesIDs returned should have at least k repetitions of all label levels.

label_levels

A character vector specifying which levels to include. If not set, all levels will be used.

Value

A vector of integers that specific which siteIDs have at least k repetitions of each label level (from the label levels that are used).

Examples

data_file <- system.file("extdata/ZD_150bins_50sampled.Rda", package = "NeuroDecodeR")
get_siteIDs_with_k_label_repetitions(data_file, "stimulus_ID", 5)
#>   [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
#>  [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
#>  [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54
#>  [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72
#>  [73]  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
#>  [91]  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
#> [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
#> [127] 127 128 129 130 131 132