Retrieves column names and labels that matches a general expression via grepl.
Arguments
- pattern
character string containing a regular expression (or character string for
fixed = TRUE
) to be matched in the given character vector. Coerced byas.character
to a character string if possible. If a character vector of length 2 or more is supplied, the first element is used with a warning. Missing values are allowed except forregexpr
,gregexpr
andregexec
.- tibble
a tibble object.
- label
a logical value indicating if pattern should be searched in variable label, instead of variable name. Default is
TRUE
.- ignore.case
if
FALSE
, the pattern matching is case sensitive and ifTRUE
, case is ignored during matching.- ...
Arguments passed on to
base::grepl
perl
logical. Should Perl-compatible regexps be used?
fixed
logical. If
TRUE
,pattern
is a string to be matched as is. Overrides all conflicting arguments.useBytes
logical. If
TRUE
the matching is done byte-by-byte rather than character-by-character. See ‘Details’.
Examples
# tibble generated by haven
input <- system.file("extdata/reds", package = "ILSAmerge")
x <- do.call(rbind,justload(inputdir = input,population = "BCGV1"))
x
#> # A tibble: 40 × 314
#> IDCNTRY IDSCHOOL ITLANGC IP1G00A IP1G00B IP1G00C
#> <dbl+lbl> <dbl+lb> <dbl+lbl> <dbl+lbl> <dbl+lbl> <dbl+lbl>
#> 1 784 [United Arab E… 1001 53 [Arabic] 2 [Mid] 3 [March] 9 (NA) [Omi…
#> 2 784 [United Arab E… 1002 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 3 784 [United Arab E… 1003 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 4 784 [United Arab E… 1004 1 [English] 3 [Late] 2 [February] 3 [Late]
#> 5 784 [United Arab E… 1005 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 6 784 [United Arab E… 1006 53 [Arabic] 2 [Mid] 2 [February] 2 [Mid]
#> 7 784 [United Arab E… 1007 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 8 784 [United Arab E… 1008 53 [Arabic] 1 [Early] 3 [March] 2 [Mid]
#> 9 784 [United Arab E… 1009 53 [Arabic] 2 [Mid] 3 [March] 1 [Early]
#> 10 784 [United Arab E… 1010 53 [Arabic] 2 [Mid] 6 [June] 3 [Late]
#> # ℹ 30 more rows
#> # ℹ 308 more variables: IP1G00D <dbl+lbl>, IP1GIAA <dbl+lbl>,
#> # IP1GIAB <dbl+lbl>, IP1GIAC <dbl+lbl>, IP1GIAD <dbl+lbl>, IP1GIAE <dbl+lbl>,
#> # IP1GIAF <dbl+lbl>, IP1GIAG <dbl+lbl>, IP1GIBA <dbl+lbl>, IP1GIBB <dbl+lbl>,
#> # IP1GIBC <dbl+lbl>, IP1GIBD <dbl+lbl>, IP1G01A <dbl+lbl>, IP1G01B <dbl+lbl>,
#> # IP1G01C1 <dbl+lbl>, IP1G01C2 <dbl+lbl>, IP2G01A1 <dbl+lbl>,
#> # IP1G01AA <dbl+lbl>, IP1G02A <dbl+lbl>, IP1G02B <dbl+lbl>, …
whichcol("weight",x)
#> name label
#> 1 TOTWGTC FINAL SCHOOL WEIGHT
#> 2 WGTFAC1 SCHOOL BASE WEIGHT
#> 3 WGTADJ1C SCHOOL WEIGHT ADJUSTMENT-SCHOOL STUDY
#> 4 CRWGT1 SCHOOL JACKKNIFE REPLICATE WEIGHT 1
#> 5 CRWGT2 SCHOOL JACKKNIFE REPLICATE WEIGHT 2
#> 6 CRWGT3 SCHOOL JACKKNIFE REPLICATE WEIGHT 3
#> 7 CRWGT4 SCHOOL JACKKNIFE REPLICATE WEIGHT 4
#> 8 CRWGT5 SCHOOL JACKKNIFE REPLICATE WEIGHT 5
#> 9 CRWGT6 SCHOOL JACKKNIFE REPLICATE WEIGHT 6
#> 10 CRWGT7 SCHOOL JACKKNIFE REPLICATE WEIGHT 7
#> 11 CRWGT8 SCHOOL JACKKNIFE REPLICATE WEIGHT 8
#> 12 CRWGT9 SCHOOL JACKKNIFE REPLICATE WEIGHT 9
#> 13 CRWGT10 SCHOOL JACKKNIFE REPLICATE WEIGHT 10
#> 14 CRWGT11 SCHOOL JACKKNIFE REPLICATE WEIGHT 11
#> 15 CRWGT12 SCHOOL JACKKNIFE REPLICATE WEIGHT 12
#> 16 CRWGT13 SCHOOL JACKKNIFE REPLICATE WEIGHT 13
#> 17 CRWGT14 SCHOOL JACKKNIFE REPLICATE WEIGHT 14
#> 18 CRWGT15 SCHOOL JACKKNIFE REPLICATE WEIGHT 15
#> 19 CRWGT16 SCHOOL JACKKNIFE REPLICATE WEIGHT 16
#> 20 CRWGT17 SCHOOL JACKKNIFE REPLICATE WEIGHT 17
#> 21 CRWGT18 SCHOOL JACKKNIFE REPLICATE WEIGHT 18
#> 22 CRWGT19 SCHOOL JACKKNIFE REPLICATE WEIGHT 19
#> 23 CRWGT20 SCHOOL JACKKNIFE REPLICATE WEIGHT 20
#> 24 CRWGT21 SCHOOL JACKKNIFE REPLICATE WEIGHT 21
#> 25 CRWGT22 SCHOOL JACKKNIFE REPLICATE WEIGHT 22
#> 26 CRWGT23 SCHOOL JACKKNIFE REPLICATE WEIGHT 23
#> 27 CRWGT24 SCHOOL JACKKNIFE REPLICATE WEIGHT 24
#> 28 CRWGT25 SCHOOL JACKKNIFE REPLICATE WEIGHT 25
#> 29 CRWGT26 SCHOOL JACKKNIFE REPLICATE WEIGHT 26
#> 30 CRWGT27 SCHOOL JACKKNIFE REPLICATE WEIGHT 27
#> 31 CRWGT28 SCHOOL JACKKNIFE REPLICATE WEIGHT 28
#> 32 CRWGT29 SCHOOL JACKKNIFE REPLICATE WEIGHT 29
#> 33 CRWGT30 SCHOOL JACKKNIFE REPLICATE WEIGHT 30
#> 34 CRWGT31 SCHOOL JACKKNIFE REPLICATE WEIGHT 31
#> 35 CRWGT32 SCHOOL JACKKNIFE REPLICATE WEIGHT 32
#> 36 CRWGT33 SCHOOL JACKKNIFE REPLICATE WEIGHT 33
#> 37 CRWGT34 SCHOOL JACKKNIFE REPLICATE WEIGHT 34
#> 38 CRWGT35 SCHOOL JACKKNIFE REPLICATE WEIGHT 35
#> 39 CRWGT36 SCHOOL JACKKNIFE REPLICATE WEIGHT 36
#> 40 CRWGT37 SCHOOL JACKKNIFE REPLICATE WEIGHT 37
#> 41 CRWGT38 SCHOOL JACKKNIFE REPLICATE WEIGHT 38
#> 42 CRWGT39 SCHOOL JACKKNIFE REPLICATE WEIGHT 39
#> 43 CRWGT40 SCHOOL JACKKNIFE REPLICATE WEIGHT 40
#> 44 CRWGT41 SCHOOL JACKKNIFE REPLICATE WEIGHT 41
#> 45 CRWGT42 SCHOOL JACKKNIFE REPLICATE WEIGHT 42
#> 46 CRWGT43 SCHOOL JACKKNIFE REPLICATE WEIGHT 43
#> 47 CRWGT44 SCHOOL JACKKNIFE REPLICATE WEIGHT 44
#> 48 CRWGT45 SCHOOL JACKKNIFE REPLICATE WEIGHT 45
#> 49 CRWGT46 SCHOOL JACKKNIFE REPLICATE WEIGHT 46
#> 50 CRWGT47 SCHOOL JACKKNIFE REPLICATE WEIGHT 47
#> 51 CRWGT48 SCHOOL JACKKNIFE REPLICATE WEIGHT 48
#> 52 CRWGT49 SCHOOL JACKKNIFE REPLICATE WEIGHT 49
#> 53 CRWGT50 SCHOOL JACKKNIFE REPLICATE WEIGHT 50
#> 54 CRWGT51 SCHOOL JACKKNIFE REPLICATE WEIGHT 51
#> 55 CRWGT52 SCHOOL JACKKNIFE REPLICATE WEIGHT 52
#> 56 CRWGT53 SCHOOL JACKKNIFE REPLICATE WEIGHT 53
#> 57 CRWGT54 SCHOOL JACKKNIFE REPLICATE WEIGHT 54
#> 58 CRWGT55 SCHOOL JACKKNIFE REPLICATE WEIGHT 55
#> 59 CRWGT56 SCHOOL JACKKNIFE REPLICATE WEIGHT 56
#> 60 CRWGT57 SCHOOL JACKKNIFE REPLICATE WEIGHT 57
#> 61 CRWGT58 SCHOOL JACKKNIFE REPLICATE WEIGHT 58
#> 62 CRWGT59 SCHOOL JACKKNIFE REPLICATE WEIGHT 59
#> 63 CRWGT60 SCHOOL JACKKNIFE REPLICATE WEIGHT 60
#> 64 CRWGT61 SCHOOL JACKKNIFE REPLICATE WEIGHT 61
#> 65 CRWGT62 SCHOOL JACKKNIFE REPLICATE WEIGHT 62
#> 66 CRWGT63 SCHOOL JACKKNIFE REPLICATE WEIGHT 63
#> 67 CRWGT64 SCHOOL JACKKNIFE REPLICATE WEIGHT 64
#> 68 CRWGT65 SCHOOL JACKKNIFE REPLICATE WEIGHT 65
#> 69 CRWGT66 SCHOOL JACKKNIFE REPLICATE WEIGHT 66
#> 70 CRWGT67 SCHOOL JACKKNIFE REPLICATE WEIGHT 67
#> 71 CRWGT68 SCHOOL JACKKNIFE REPLICATE WEIGHT 68
#> 72 CRWGT69 SCHOOL JACKKNIFE REPLICATE WEIGHT 69
#> 73 CRWGT70 SCHOOL JACKKNIFE REPLICATE WEIGHT 70
#> 74 CRWGT71 SCHOOL JACKKNIFE REPLICATE WEIGHT 71
#> 75 CRWGT72 SCHOOL JACKKNIFE REPLICATE WEIGHT 72
#> 76 CRWGT73 SCHOOL JACKKNIFE REPLICATE WEIGHT 73
#> 77 CRWGT74 SCHOOL JACKKNIFE REPLICATE WEIGHT 74
#> 78 CRWGT75 SCHOOL JACKKNIFE REPLICATE WEIGHT 75