Skip to contents

Check for value(s) in the dataset

Usage

check_value(
  dataset,
  uuid_column = "uuid",
  element_name = "checked_dataset",
  values_to_look = c(99, 999, 999, 88, 888, 888)
)

Arguments

dataset

dataset to be check as a dataframe or a list with the dataframe stored as "checked_dataset"

uuid_column

uuid column in the dataset. Default is "uuid".

element_name

Name of the dataset in list

values_to_look

Values to look. Default are- 99,999,999,88,888,888

Value

A dataframe as cleaning log format

Examples

df <- data.frame(
  X_uuid = paste0("uuid_", 1:100),
  age = c(sample(18:80, replace = TRUE, size = 96), 99, 99, 98, 88),
  gender = c("99", sample(c("male", "female"),
    replace = TRUE, size = 95
  ), "98", "98", "88", "888")
)
check_value(
  dataset = df, uuid_column = "X_uuid",
  element_name = "checked_dataset",
  values_to_look = c(99, 98, 88, 888)
)
#> $checked_dataset
#>       X_uuid age gender
#> 1     uuid_1  80     99
#> 2     uuid_2  24 female
#> 3     uuid_3  24 female
#> 4     uuid_4  75   male
#> 5     uuid_5  23 female
#> 6     uuid_6  22 female
#> 7     uuid_7  29   male
#> 8     uuid_8  25   male
#> 9     uuid_9  28   male
#> 10   uuid_10  49 female
#> 11   uuid_11  33 female
#> 12   uuid_12  28   male
#> 13   uuid_13  51 female
#> 14   uuid_14  27   male
#> 15   uuid_15  28 female
#> 16   uuid_16  25 female
#> 17   uuid_17  35 female
#> 18   uuid_18  39   male
#> 19   uuid_19  71 female
#> 20   uuid_20  34   male
#> 21   uuid_21  22 female
#> 22   uuid_22  32   male
#> 23   uuid_23  22 female
#> 24   uuid_24  45   male
#> 25   uuid_25  29   male
#> 26   uuid_26  55 female
#> 27   uuid_27  42   male
#> 28   uuid_28  46 female
#> 29   uuid_29  64   male
#> 30   uuid_30  45 female
#> 31   uuid_31  34 female
#> 32   uuid_32  50 female
#> 33   uuid_33  58 female
#> 34   uuid_34  69   male
#> 35   uuid_35  35   male
#> 36   uuid_36  73 female
#> 37   uuid_37  65   male
#> 38   uuid_38  40   male
#> 39   uuid_39  79   male
#> 40   uuid_40  49   male
#> 41   uuid_41  40   male
#> 42   uuid_42  28 female
#> 43   uuid_43  43 female
#> 44   uuid_44  24 female
#> 45   uuid_45  23   male
#> 46   uuid_46  38 female
#> 47   uuid_47  59   male
#> 48   uuid_48  58   male
#> 49   uuid_49  71   male
#> 50   uuid_50  63 female
#> 51   uuid_51  78   male
#> 52   uuid_52  41   male
#> 53   uuid_53  79 female
#> 54   uuid_54  80   male
#> 55   uuid_55  52 female
#> 56   uuid_56  29   male
#> 57   uuid_57  27   male
#> 58   uuid_58  27 female
#> 59   uuid_59  77   male
#> 60   uuid_60  44   male
#> 61   uuid_61  51 female
#> 62   uuid_62  59 female
#> 63   uuid_63  24   male
#> 64   uuid_64  72   male
#> 65   uuid_65  69 female
#> 66   uuid_66  61 female
#> 67   uuid_67  30 female
#> 68   uuid_68  45 female
#> 69   uuid_69  65   male
#> 70   uuid_70  72 female
#> 71   uuid_71  43   male
#> 72   uuid_72  19   male
#> 73   uuid_73  26   male
#> 74   uuid_74  59   male
#> 75   uuid_75  29   male
#> 76   uuid_76  23 female
#> 77   uuid_77  62   male
#> 78   uuid_78  75 female
#> 79   uuid_79  51 female
#> 80   uuid_80  19   male
#> 81   uuid_81  58 female
#> 82   uuid_82  50 female
#> 83   uuid_83  34 female
#> 84   uuid_84  18 female
#> 85   uuid_85  45   male
#> 86   uuid_86  50   male
#> 87   uuid_87  74 female
#> 88   uuid_88  67   male
#> 89   uuid_89  52   male
#> 90   uuid_90  33 female
#> 91   uuid_91  48 female
#> 92   uuid_92  58   male
#> 93   uuid_93  29   male
#> 94   uuid_94  78 female
#> 95   uuid_95  30   male
#> 96   uuid_96  63   male
#> 97   uuid_97  99     98
#> 98   uuid_98  99     98
#> 99   uuid_99  98     88
#> 100 uuid_100  88    888
#> 
#> $flaged_value
#> # A tibble: 9 × 4
#>   uuid     question old_value issue                             
#>   <chr>    <chr>    <chr>     <chr>                             
#> 1 uuid_1   gender   99        Possible value to be changed to NA
#> 2 uuid_97  age      99        Possible value to be changed to NA
#> 3 uuid_97  gender   98        Possible value to be changed to NA
#> 4 uuid_98  age      99        Possible value to be changed to NA
#> 5 uuid_98  gender   98        Possible value to be changed to NA
#> 6 uuid_99  age      98        Possible value to be changed to NA
#> 7 uuid_99  gender   88        Possible value to be changed to NA
#> 8 uuid_100 age      88        Possible value to be changed to NA
#> 9 uuid_100 gender   888       Possible value to be changed to NA
#>