Starting with data

Pengantar

Pada perkuliahan kali ini kita akan membahas tuntas tentang bagaimana kita memulai pekerjaan menggunakan data. Data yang digunakan dalam perkuliahan kali ini ialah data SAFI (Studying African Farmer-Led Irrigation), kita akan menggunakan data yang sudah bersih (SAFI_clean.csv).

Column_name description
key_id Added to provide a unique Id for each observation. (The InstanceID field does this as well but it is not as convenient to use)
village Village name
interview_date Date of interview
no_members How many members in the household?
years_liv How many years have you been living in this village or neighboring village?
respondent_wall_type What type of walls does their house have (from list)
rooms How many rooms in the main house are used for sleeping?
memb_assoc Are you a member of an irrigation association?
affect_conflicts Have you been affected by conflicts with other irrigators in the area?
liv_count Number of livestock owned.
items_owned Which of the following items are owned by the household? (list)
no_meals How many meals do people in your household normally eat in a day?
months_lack_food Indicate which months, In the last 12 months have you faced a situation when you did not have enough food to feed the household?
instanceID Unique identifier for the form data submission

Importing Data

safi <- read.csv("C:\\Users\\User\\Documents\\Data\\SAFI_clean.csv")
head(safi)
  key_ID village       interview_date no_membrs years_liv respondent_wall_type
1      1     God 2016-11-17T00:00:00Z         3         4              muddaub
2      1     God 2016-11-17T00:00:00Z         7         9              muddaub
3      3     God 2016-11-17T00:00:00Z        10        15          burntbricks
4      4     God 2016-11-17T00:00:00Z         7         6          burntbricks
5      5     God 2016-11-17T00:00:00Z         7        40          burntbricks
6      6     God 2016-11-17T00:00:00Z         3         3              muddaub
  rooms memb_assoc affect_conflicts liv_count
1     1       NULL             NULL         1
2     1        yes             once         3
3     1       NULL             NULL         1
4     1       NULL             NULL         2
5     1       NULL             NULL         4
6     1       NULL             NULL         1
                                                                   items_owned
1                                         bicycle;television;solar_panel;table
2 cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
3                                                                  solar_torch
4                            bicycle;radio;cow_plough;solar_panel;mobile_phone
5                                      motorcyle;radio;cow_plough;mobile_phone
6                                                                         NULL
  no_meals        months_lack_food                                instanceID
1        2                     Jan uuid:ec241f2c-0609-46ed-b5e8-fe575f6cefef
2        2    Jan;Sept;Oct;Nov;Dec uuid:099de9c9-3e5e-427b-8452-26250e840d6e
3        2 Jan;Feb;Mar;Oct;Nov;Dec uuid:193d7daf-9582-409b-bf09-027dd36f9007
4        2        Sept;Oct;Nov;Dec uuid:148d1105-778a-4755-aa71-281eadd4a973
5        2        Aug;Sept;Oct;Nov uuid:2c867811-9696-4966-9866-f35c3e97d02d
6        2            Aug;Sept;Oct uuid:daa56c91-c8e3-44c3-a663-af6a49a2ca70
getwd()
[1] "C:/Users/User/Documents/Kerjaan/STA1517/Praktikum STA1517"
safii <- read.csv("SAFI_clean.csv")
head(safii)
  key_ID village       interview_date no_membrs years_liv respondent_wall_type
1      1     God 2016-11-17T00:00:00Z         3         4              muddaub
2      1     God 2016-11-17T00:00:00Z         7         9              muddaub
3      3     God 2016-11-17T00:00:00Z        10        15          burntbricks
4      4     God 2016-11-17T00:00:00Z         7         6          burntbricks
5      5     God 2016-11-17T00:00:00Z         7        40          burntbricks
6      6     God 2016-11-17T00:00:00Z         3         3              muddaub
  rooms memb_assoc affect_conflicts liv_count
1     1       NULL             NULL         1
2     1        yes             once         3
3     1       NULL             NULL         1
4     1       NULL             NULL         2
5     1       NULL             NULL         4
6     1       NULL             NULL         1
                                                                   items_owned
1                                         bicycle;television;solar_panel;table
2 cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
3                                                                  solar_torch
4                            bicycle;radio;cow_plough;solar_panel;mobile_phone
5                                      motorcyle;radio;cow_plough;mobile_phone
6                                                                         NULL
  no_meals        months_lack_food                                instanceID
1        2                     Jan uuid:ec241f2c-0609-46ed-b5e8-fe575f6cefef
2        2    Jan;Sept;Oct;Nov;Dec uuid:099de9c9-3e5e-427b-8452-26250e840d6e
3        2 Jan;Feb;Mar;Oct;Nov;Dec uuid:193d7daf-9582-409b-bf09-027dd36f9007
4        2        Sept;Oct;Nov;Dec uuid:148d1105-778a-4755-aa71-281eadd4a973
5        2        Aug;Sept;Oct;Nov uuid:2c867811-9696-4966-9866-f35c3e97d02d
6        2            Aug;Sept;Oct uuid:daa56c91-c8e3-44c3-a663-af6a49a2ca70

dari pengerjaan diatas kita mengetahui fungsi head() ialah menampilkan 6 data pengamatan awal. Sementara kalau ingin melihat 6 data terakhir kita bisa menggunakan fungsi tail().

summary(safi)
     key_ID         village          interview_date       no_membrs     
 Min.   :  1.00   Length:131         Length:131         Min.   : 2.000  
 1st Qu.: 32.50   Class :character   Class :character   1st Qu.: 5.000  
 Median : 66.00   Mode  :character   Mode  :character   Median : 7.000  
 Mean   : 85.47                                         Mean   : 7.191  
 3rd Qu.:138.00                                         3rd Qu.: 9.000  
 Max.   :202.00                                         Max.   :19.000  
   years_liv     respondent_wall_type     rooms       memb_assoc       
 Min.   : 1.00   Length:131           Min.   :1.00   Length:131        
 1st Qu.:12.00   Class :character     1st Qu.:1.00   Class :character  
 Median :20.00   Mode  :character     Median :1.00   Mode  :character  
 Mean   :23.05                        Mean   :1.74                     
 3rd Qu.:27.50                        3rd Qu.:2.00                     
 Max.   :96.00                        Max.   :8.00                     
 affect_conflicts     liv_count     items_owned           no_meals    
 Length:131         Min.   :1.000   Length:131         Min.   :2.000  
 Class :character   1st Qu.:1.000   Class :character   1st Qu.:2.000  
 Mode  :character   Median :2.000   Mode  :character   Median :3.000  
                    Mean   :2.366                      Mean   :2.603  
                    3rd Qu.:3.000                      3rd Qu.:3.000  
                    Max.   :5.000                      Max.   :3.000  
 months_lack_food    instanceID       
 Length:131         Length:131        
 Class :character   Class :character  
 Mode  :character   Mode  :character  
                                      
                                      
                                      
str(safi)
'data.frame':   131 obs. of  14 variables:
 $ key_ID              : int  1 1 3 4 5 6 7 8 9 10 ...
 $ village             : chr  "God" "God" "God" "God" ...
 $ interview_date      : chr  "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" ...
 $ no_membrs           : int  3 7 10 7 7 3 6 12 8 12 ...
 $ years_liv           : int  4 9 15 6 40 3 38 70 6 23 ...
 $ respondent_wall_type: chr  "muddaub" " muddaub" " burntbricks" " burntbricks" ...
 $ rooms               : int  1 1 1 1 1 1 1 3 1 5 ...
 $ memb_assoc          : chr  "NULL" "yes" "NULL" "NULL" ...
 $ affect_conflicts    : chr  "NULL" "once" "NULL" "NULL" ...
 $ liv_count           : int  1 3 1 2 4 1 1 2 3 2 ...
 $ items_owned         : chr  "bicycle;television;solar_panel;table" "cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone" "solar_torch" "bicycle;radio;cow_plough;solar_panel;mobile_phone" ...
 $ no_meals            : int  2 2 2 2 2 2 3 2 3 3 ...
 $ months_lack_food    : chr  "Jan" "Jan;Sept;Oct;Nov;Dec" "Jan;Feb;Mar;Oct;Nov;Dec" "Sept;Oct;Nov;Dec" ...
 $ instanceID          : chr  "uuid:ec241f2c-0609-46ed-b5e8-fe575f6cefef" "uuid:099de9c9-3e5e-427b-8452-26250e840d6e" "uuid:193d7daf-9582-409b-bf09-027dd36f9007" "uuid:148d1105-778a-4755-aa71-281eadd4a973" ...
names(safi)
 [1] "key_ID"               "village"              "interview_date"      
 [4] "no_membrs"            "years_liv"            "respondent_wall_type"
 [7] "rooms"                "memb_assoc"           "affect_conflicts"    
[10] "liv_count"            "items_owned"          "no_meals"            
[13] "months_lack_food"     "instanceID"          

Subsetting Data Frames

## first element in the first column of the tibble
safi[1, 1]
[1] 1
## first element in the 6th column of the tibble 
safi[1, 6]
[1] "muddaub"
## first column of the tibble (as a vector)
safi[[1]]
  [1]   1   1   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  21  54
 [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71 127
 [73] 133 152 153 155 178 177 180 181 182 186 187 195 196 197 198 201 202  72
 [91]  73  76  83  85  89 101 103 102  78  80 104 105 106 109 110 113 118 125
[109] 119 115 108 116 117 144 143 150 159 160 165 166 167 174 175 189 191 192
[127] 126 193 194 199 200
## first column of the tibble
safi[1]
    key_ID
1        1
2        1
3        3
4        4
5        5
6        6
7        7
8        8
9        9
10      10
11      11
12      12
13      13
14      14
15      15
16      16
17      17
18      18
19      19
20      20
21      21
22      22
23      23
24      24
25      25
26      26
27      27
28      28
29      29
30      30
31      31
32      32
33      33
34      34
35      35
36      36
37      37
38      38
39      39
40      40
41      41
42      42
43      43
44      44
45      45
46      46
47      47
48      48
49      49
50      50
51      51
52      52
53      21
54      54
55      55
56      56
57      57
58      58
59      59
60      60
61      61
62      62
63      63
64      64
65      65
66      66
67      67
68      68
69      69
70      70
71      71
72     127
73     133
74     152
75     153
76     155
77     178
78     177
79     180
80     181
81     182
82     186
83     187
84     195
85     196
86     197
87     198
88     201
89     202
90      72
91      73
92      76
93      83
94      85
95      89
96     101
97     103
98     102
99      78
100     80
101    104
102    105
103    106
104    109
105    110
106    113
107    118
108    125
109    119
110    115
111    108
112    116
113    117
114    144
115    143
116    150
117    159
118    160
119    165
120    166
121    167
122    174
123    175
124    189
125    191
126    192
127    126
128    193
129    194
130    199
131    200
safi[, -1]          # The whole tibble, except the first column
     village       interview_date no_membrs years_liv respondent_wall_type
1        God 2016-11-17T00:00:00Z         3         4              muddaub
2        God 2016-11-17T00:00:00Z         7         9              muddaub
3        God 2016-11-17T00:00:00Z        10        15          burntbricks
4        God 2016-11-17T00:00:00Z         7         6          burntbricks
5        God 2016-11-17T00:00:00Z         7        40          burntbricks
6        God 2016-11-17T00:00:00Z         3         3              muddaub
7        God 2016-11-17T00:00:00Z         6        38              muddaub
8   Chirodzo 2016-11-16T00:00:00Z        12        70          burntbricks
9   Chirodzo 2016-11-16T00:00:00Z         8         6          burntbricks
10  Chirodzo 2016-12-16T00:00:00Z        12        23          burntbricks
11       God 2016-11-21T00:00:00Z         6        20            sunbricks
12       God 2016-11-21T00:00:00Z         7        20          burntbricks
13       God 2016-11-21T00:00:00Z         6         8          burntbricks
14       God 2016-11-21T00:00:00Z        10        20          burntbricks
15       God 2016-11-21T00:00:00Z         5        30            sunbricks
16       God 2016-11-24T00:00:00Z         6        47              muddaub
17       God 2016-11-21T00:00:00Z         8        20            sunbricks
18       God 2016-11-21T00:00:00Z         4        20              muddaub
19       God 2016-11-21T00:00:00Z         9        23          burntbricks
20       God 2016-11-21T00:00:00Z         6         1          burntbricks
21       God 2016-11-21T00:00:00Z         8        20          burntbricks
22       God 2016-11-21T00:00:00Z         4        20              muddaub
23     Ruaca 2016-11-21T00:00:00Z        10        20          burntbricks
24     Ruaca 2016-11-21T00:00:00Z         6         4          burntbricks
25     Ruaca 2016-11-21T00:00:00Z        11         6          burntbricks
26     Ruaca 2016-11-21T00:00:00Z         3        20          burntbricks
27     Ruaca 2016-11-21T00:00:00Z         7        36          burntbricks
28     Ruaca 2016-11-21T00:00:00Z         2         2              muddaub
29     Ruaca 2016-11-21T00:00:00Z         7        10          burntbricks
30     Ruaca 2016-11-21T00:00:00Z         7        22              muddaub
31     Ruaca 2016-11-21T00:00:00Z         3         2              muddaub
32     Ruaca 2016-11-21T00:00:00Z        19        69              muddaub
33     Ruaca 2016-11-21T00:00:00Z         8        34              muddaub
34  Chirodzo 2016-11-17T00:00:00Z         8        18          burntbricks
35  Chirodzo 2016-11-17T00:00:00Z         5        45              muddaub
36  Chirodzo 2016-11-17T00:00:00Z         6        23            sunbricks
37  Chirodzo 2016-11-17T00:00:00Z         3         8          burntbricks
38       God 2016-11-17T00:00:00Z        10        19              muddaub
39       God 2016-11-17T00:00:00Z         6        22              muddaub
40       God 2016-11-17T00:00:00Z         9        23          burntbricks
41       God 2016-11-17T00:00:00Z         7        22              muddaub
42       God 2016-11-17T00:00:00Z         8         8            sunbricks
43  Chirodzo 2016-11-17T00:00:00Z         7        29              muddaub
44  Chirodzo 2016-11-17T00:00:00Z         2         6              muddaub
45  Chirodzo 2016-11-17T00:00:00Z         9         7              muddaub
46  Chirodzo 2016-11-17T00:00:00Z        10        42          burntbricks
47  Chirodzo 2016-11-17T00:00:00Z         2         2              muddaub
48  Chirodzo 2016-11-16T00:00:00Z         7        58              muddaub
49  Chirodzo 2016-11-16T00:00:00Z         6        26          burntbricks
50  Chirodzo 2016-11-16T00:00:00Z         6         7              muddaub
51  Chirodzo 2016-11-16T00:00:00Z         5        30              muddaub
52  Chirodzo 2016-11-16T00:00:00Z        11        15          burntbricks
53  Chirodzo 2016-11-16T00:00:00Z         8        16          burntbricks
54  Chirodzo 2016-11-16T00:00:00Z         7        15              muddaub
55  Chirodzo 2016-11-16T00:00:00Z         9        23              muddaub
56  Chirodzo 2016-11-16T00:00:00Z        12        23          burntbricks
57  Chirodzo 2016-11-16T00:00:00Z         4        27          burntbricks
58  Chirodzo 2016-11-16T00:00:00Z        11        45          burntbricks
59  Chirodzo 2016-11-16T00:00:00Z         2        60              muddaub
60  Chirodzo 2016-11-16T00:00:00Z         8        15          burntbricks
61  Chirodzo 2016-11-16T00:00:00Z        10        14              muddaub
62  Chirodzo 2016-11-16T00:00:00Z         5         5              muddaub
63  Chirodzo 2016-11-16T00:00:00Z         4        10              muddaub
64  Chirodzo 2016-11-16T00:00:00Z         6         1              muddaub
65  Chirodzo 2016-11-16T00:00:00Z         8        20          burntbricks
66  Chirodzo 2016-11-16T00:00:00Z        10        37          burntbricks
67  Chirodzo 2016-11-16T00:00:00Z         5        31          burntbricks
68  Chirodzo 2016-11-16T00:00:00Z         8        52          burntbricks
69  Chirodzo 2016-11-16T00:00:00Z         4        12              muddaub
70  Chirodzo 2016-11-16T00:00:00Z         8        25          burntbricks
71     Ruaca 2016-11-18T00:00:00Z         6        14          burntbricks
72  Chirodzo 2016-11-16T00:00:00Z         4        18          burntbricks
73     Ruaca 2016-11-23T00:00:00Z         5        25          burntbricks
74     Ruaca 2016-11-24T00:00:00Z        10        16          burntbricks
75     Ruaca 2016-11-24T00:00:00Z         5        41          burntbricks
76       God 2016-11-24T00:00:00Z         4         4          burntbricks
77     Ruaca 2016-11-25T00:00:00Z         5        79          burntbricks
78       God 2016-11-25T00:00:00Z        10        13            sunbricks
79     Ruaca 2016-11-25T00:00:00Z         7        50              muddaub
80       God 2016-11-25T00:00:00Z        11        25            sunbricks
81       God 2016-11-25T00:00:00Z         7        21              muddaub
82       God 2016-11-28T00:00:00Z         7        24              muddaub
83       God 2016-11-28T00:00:00Z         5        43              muddaub
84       God 2016-11-28T00:00:00Z         5        48          burntbricks
85       God 2016-11-28T00:00:00Z         7        49          burntbricks
86       God 2016-11-28T00:00:00Z         5        19          burntbricks
87       God 2016-11-28T00:00:00Z         3        49          burntbricks
88       God 2016-11-21T00:00:00Z         4         6              muddaub
89       God 2016-11-17T00:00:00Z        12        12          burntbricks
90     Ruaca 2017-04-26T00:00:00Z         6        24              muddaub
91     Ruaca 2017-04-26T00:00:00Z         7         9          burntbricks
92     Ruaca 2017-04-26T00:00:00Z        17        48          burntbricks
93     Ruaca 2017-04-27T00:00:00Z         5        22          burntbricks
94     Ruaca 2017-04-27T00:00:00Z         7        40            sunbricks
95       God 2017-04-27T00:00:00Z         5        10          burntbricks
96       God 2017-04-27T00:00:00Z         3         4              muddaub
97     Ruaca 2017-04-27T00:00:00Z         6        96            sunbricks
98     Ruaca 2017-04-28T00:00:00Z        12        15          burntbricks
99     Ruaca 2017-04-28T00:00:00Z         6        48          burntbricks
100    Ruaca 2017-04-28T00:00:00Z         5        12              muddaub
101    Ruaca 2017-04-28T00:00:00Z        14        52            sunbricks
102    Ruaca 2017-04-28T00:00:00Z         6        40            sunbricks
103      God 2017-04-30T00:00:00Z        15        22            sunbricks
104      God 2017-05-03T00:00:00Z         4        12            sunbricks
105    Ruaca 2017-05-03T00:00:00Z         6        22            sunbricks
106    Ruaca 2017-05-03T00:00:00Z        11        26          burntbricks
107    Ruaca 2017-05-04T00:00:00Z         5        25              muddaub
108    Ruaca 2017-05-04T00:00:00Z         5        14          burntbricks
109    Ruaca 2017-05-04T00:00:00Z         3        14              muddaub
110    Ruaca 2017-05-11T00:00:00Z         4        16            sunbricks
111      God 2017-05-11T00:00:00Z        15        22          burntbricks
112    Ruaca 2017-05-11T00:00:00Z         5        25          burntbricks
113    Ruaca 2017-05-11T00:00:00Z        10        28              muddaub
114    Ruaca 2017-05-18T00:00:00Z         7         5          burntbricks
115    Ruaca 2017-05-18T00:00:00Z        10        24          burntbricks
116    Ruaca 2017-05-18T00:00:00Z         7         8              muddaub
117      God 2017-05-18T00:00:00Z         4        24            sunbricks
118      God 2017-06-03T00:00:00Z         7        13          burntbricks
119    Ruaca 2017-06-03T00:00:00Z         9        14          burntbricks
120    Ruaca 2017-06-03T00:00:00Z        11        16              muddaub
121    Ruaca 2017-06-03T00:00:00Z         8        24              muddaub
122    Ruaca 2017-06-03T00:00:00Z        12        25          burntbricks
123    Ruaca 2017-06-03T00:00:00Z         7        36          burntbricks
124    Ruaca 2017-06-03T00:00:00Z        15        16            sunbricks
125    Ruaca 2017-06-03T00:00:00Z        10         5          burntbricks
126 Chirodzo 2017-06-03T00:00:00Z         9        20          burntbricks
127    Ruaca 2017-05-18T00:00:00Z         3         7          burntbricks
128    Ruaca 2017-06-04T00:00:00Z         7        10               cement
129    Ruaca 2017-06-04T00:00:00Z         4         5              muddaub
130 Chirodzo 2017-06-04T00:00:00Z         7        17          burntbricks
131 Chirodzo 2017-06-04T00:00:00Z         8        20          burntbricks
    rooms memb_assoc affect_conflicts liv_count
1       1       NULL             NULL         1
2       1        yes             once         3
3       1       NULL             NULL         1
4       1       NULL             NULL         2
5       1       NULL             NULL         4
6       1       NULL             NULL         1
7       1         no            never         1
8       3        yes            never         2
9       1         no            never         3
10      5         no            never         2
11      1       NULL             NULL         2
12      3        yes            never         2
13      1         no            never         3
14      3       NULL             NULL         3
15      2        yes             once         3
16      1       NULL             NULL         4
17      1       NULL             NULL         1
18      1       NULL             NULL         3
19      2       NULL             NULL         2
20      1       NULL             NULL         1
21      1         no            never         3
22      1       NULL             NULL         1
23      4       NULL             NULL         3
24      2         no            never         3
25      3         no            never         2
26      2         no            never         2
27      2       NULL             NULL         3
28      1         no        more_once         1
29      2        yes       frequently         1
30      2       NULL             NULL         1
31      1       NULL             NULL         1
32      2        yes        more_once         5
33      1         no        more_once         2
34      3        yes        more_once         3
35      1        yes        more_once         2
36      1        yes             once         3
37      1       NULL             NULL         2
38      1        yes            never         3
39      1       NULL             NULL         1
40      1        yes            never         1
41      1       NULL             NULL         2
42      1         no            never         3
43      1         no            never         2
44      1       NULL             NULL         3
45      1         no            never         4
46      2         no             once         2
47      1        yes             once         1
48      1       NULL             NULL         3
49      2       NULL             NULL         2
50      1        yes            never         1
51      1       NULL             NULL         1
52      3         no            never         3
53      3        yes       frequently         2
54      1         no            never         1
55      2       NULL             NULL         1
56      2        yes            never         2
57      1         no            never         1
58      3         no            never         3
59      3       NULL             NULL         3
60      2         no            never         4
61      1        yes        more_once         3
62      1       NULL             NULL         1
63      1       NULL             NULL         1
64      1       NULL             NULL         1
65      3         no             once         3
66      3        yes       frequently         4
67      2         no        more_once         4
68      3         no        more_once         3
69      1         no        more_once         1
70      2         no        more_once         4
71      1        yes        more_once         3
72      8       NULL             NULL         1
73      2         no            never         5
74      1        yes             once         3
75      1       NULL             NULL         1
76      1       NULL             NULL         1
77      2        yes       frequently         3
78      1         no        more_once         2
79      1         no            never         3
80      2        yes        more_once         3
81      3         no        more_once         2
82      1         no        more_once         2
83      2        yes        more_once         4
84      1         no            never         3
85      2        yes        more_once         3
86      2         no        more_once         3
87      1         no            never         1
88      2       NULL             NULL         2
89      4        yes        more_once         3
90      1        yes        more_once         3
91      2        yes        more_once         3
92      2        yes        more_once         4
93      1        yes            never         2
94      1         no            never         2
95      2         no            never         3
96      1         no            never         1
97      1         no            never         5
98      2        yes       frequently         2
99      1         no        more_once         2
100     1         no        more_once         1
101     1        yes            never         4
102     1        yes       frequently         2
103     5         no            never         2
104     1       NULL             NULL         3
105     3         no            never         3
106     3         no            never         4
107     1       NULL             NULL         1
108     1         no        more_once         2
109     1         no            never         4
110     2       NULL             NULL         3
111     2         no            never         4
112     3       NULL             NULL         3
113     4       NULL             NULL         1
114     4         no       frequently         4
115     2         no       frequently         3
116     1         no            never         1
117     1         no            never         1
118     2        yes       frequently         2
119     1         no            never         3
120     1         no            never         1
121     1         no            never         3
122     2         no            never         3
123     1         no            never         4
124     1         no            never         3
125     4         no            never         1
126     1         no             once         1
127     1         no        more_once         3
128     3         no        more_once         3
129     1         no        more_once         1
130     2        yes        more_once         2
131     2       NULL             NULL         3
                                                                                                                                 items_owned
1                                                                                                       bicycle;television;solar_panel;table
2                                                               cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
3                                                                                                                                solar_torch
4                                                                                          bicycle;radio;cow_plough;solar_panel;mobile_phone
5                                                                                                    motorcyle;radio;cow_plough;mobile_phone
6                                                                                                                                       NULL
7                                                                                                                       motorcyle;cow_plough
8                                                         motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;table;fridge
9                                                                                                         television;solar_panel;solar_torch
10                                                      cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;table
11                                                                                                                          radio;cow_plough
12                                                                                                   cow_cart;bicycle;radio;cow_plough;table
13                                                                                                     bicycle;radio;cow_plough;mobile_phone
14                                                                                   bicycle;radio;cow_plough;solar_panel;table;mobile_phone
15                                                                                                bicycle;radio;cow_plough;solar_panel;table
16                                                                                                  radio;cow_plough;solar_panel;solar_torch
17                                                                                                                              mobile_phone
18                                                                                                                      bicycle;mobile_phone
19                                                                             bicycle;radio;cow_plough;solar_panel;solar_torch;mobile_phone
20                                                                                                            bicycle;cow_plough;solar_torch
21                                                                                                                                      NULL
22                                                                                                                                     radio
23                                                         cow_cart;bicycle;television;radio;cow_plough;solar_panel;electricity;mobile_phone
24                                                                                                         radio;table;sofa_set;mobile_phone
25                                        cow_cart;motorcyle;television;radio;cow_plough;solar_panel;solar_torch;table;sofa_set;mobile_phone
26                                                                                                       radio;cow_plough;table;mobile_phone
27                                                                             bicycle;radio;cow_plough;solar_panel;solar_torch;mobile_phone
28                                                                                                                                      NULL
29                                                                                                motorcyle;bicycle;radio;table;mobile_phone
30                                                                                                                bicycle;radio;mobile_phone
31                                                                                                                                      NULL
32                                                                              cow_cart;motorcyle;radio;cow_plough;solar_panel;mobile_phone
33                                                                       cow_cart;lorry;motorcyle;sterio;cow_plough;solar_panel;mobile_phone
34                                                                    television;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
35                                                                                                                        bicycle;cow_plough
36                                                                                cow_cart;bicycle;radio;cow_plough;solar_panel;mobile_phone
37                                                                  bicycle;television;radio;cow_plough;solar_panel;solar_torch;mobile_phone
38                                                                                   bicycle;radio;cow_plough;solar_panel;table;mobile_phone
39                                                                                                                                      NULL
40                                                                                   bicycle;radio;cow_plough;solar_panel;table;mobile_phone
41                                                                                                  motorcyle;bicycle;radio;cow_plough;table
42                                                                                                                              mobile_phone
43                                                                                                                   cow_plough;mobile_phone
44                                                                                                                         radio;solar_torch
45                                                  motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
46                                                           motorcyle;computer;television;sterio;solar_panel;solar_torch;table;mobile_phone
47                                                                                                                  solar_torch;mobile_phone
48                                                                                                                                     radio
49                                                                       bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
50                                                                                                                               solar_torch
51                                                                                                                                     radio
52                                                                            motorcyle;television;radio;cow_plough;solar_panel;mobile_phone
53                                                                                                                bicycle;radio;mobile_phone
54                                                                                                                                      NULL
55                                                                                                        television;cow_plough;mobile_phone
56                                                                                                            motorcyle;bicycle;mobile_phone
57                                                                                                                                     radio
58                                                                    motorcyle;bicycle;television;radio;cow_plough;solar_panel;mobile_phone
59                                                                                                                                      NULL
60                                                                                                                                cow_plough
61                                                     cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;table;mobile_phone
62                                                                                                                bicycle;radio;mobile_phone
63                                                                                                                                      NULL
64                                                                                           bicycle;solar_torch;table;sofa_set;mobile_phone
65                                                                                                          motorcyle;radio;cow_plough;table
66                                               cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;mobile_phone
67                                                                                       motorcyle;radio;cow_plough;solar_panel;mobile_phone
68                                                                                      motorcyle;television;sterio;solar_panel;mobile_phone
69                                                                                                    bicycle;radio;solar_torch;mobile_phone
70                                                                                cow_cart;bicycle;radio;cow_plough;solar_panel;mobile_phone
71                                                                                                             radio;cow_plough;mobile_phone
72                                                                                                                              mobile_phone
73  cow_cart;car;lorry;motorcyle;bicycle;television;sterio;cow_plough;solar_panel;solar_torch;electricity;table;sofa_set;mobile_phone;fridge
74                                                                        motorcyle;bicycle;radio;sterio;cow_plough;solar_panel;mobile_phone
75                                                                                                                                      NULL
76                                                                                                                               electricity
77                                                                                                 radio;cow_plough;solar_panel;mobile_phone
78                                                                                  motorcyle;television;cow_plough;solar_panel;mobile_phone
79                                                                                                                    cow_plough;solar_panel
80                                                           cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;mobile_phone
81                                                                                                                               solar_panel
82                                                                                                                   cow_plough;mobile_phone
83                                               cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;mobile_phone
84                                                                                             cow_cart;bicycle;radio;cow_plough;solar_torch
85                                                                                                             radio;cow_plough;mobile_phone
86                                                                        bicycle;television;radio;cow_plough;solar_torch;table;mobile_phone
87                                                                                                                                      NULL
88                                                                                                    bicycle;radio;solar_torch;mobile_phone
89                                                                      cow_cart;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
90                                                                                                                  bicycle;radio;cow_plough
91                                                     cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;table;mobile_phone
92                                                                                         bicycle;radio;cow_plough;solar_panel;mobile_phone
93                                                                                                              radio;cow_plough;solar_torch
94                                                                                                                          radio;cow_plough
95                                                                       bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
96                                                                                                                       bicycle;solar_torch
97                                                                                     cow_cart;cow_plough;solar_panel;sofa_set;mobile_phone
98                                                                                                    cow_plough;table;sofa_set;mobile_phone
99                                                                                                                                cow_plough
100                                                                                cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch
101                                                                                                              cow_cart;bicycle;cow_plough
102                                                                                      motorcyle;radio;cow_plough;solar_panel;mobile_phone
103                                            cow_cart;motorcyle;bicycle;radio;sterio;cow_plough;solar_panel;solar_torch;table;mobile_phone
104                                                                                                  cow_cart;bicycle;radio;cow_plough;table
105                                                                                              bicycle;radio;cow_plough;table;mobile_phone
106                                                   cow_cart;motorcyle;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
107                                                                                                           radio;solar_torch;mobile_phone
108                                                                            bicycle;radio;cow_plough;solar_panel;solar_torch;mobile_phone
109                                                                                              bicycle;cow_plough;solar_panel;mobile_phone
110                                        cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
111                                                                         cow_cart;bicycle;radio;cow_plough;solar_panel;table;mobile_phone
112                                                 motorcyle;bicycle;television;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
113                                                                    motorcyle;television;radio;solar_panel;solar_torch;table;mobile_phone
114                                                          cow_cart;television;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
115                                                            cow_cart;motorcyle;television;radio;cow_plough;solar_torch;table;mobile_phone
116                                                                                                                             mobile_phone
117                                                                                                            radio;solar_panel;solar_torch
118                                                                                             cow_cart;cow_plough;solar_torch;mobile_phone
119                        cow_cart;motorcyle;bicycle;television;radio;cow_plough;solar_torch;electricity;table;sofa_set;mobile_phone;fridge
120                                                                                                         bicycle;solar_torch;mobile_phone
121                                                                    motorcyle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
122                                   car;lorry;motorcyle;radio;sterio;cow_plough;solar_panel;solar_torch;table;sofa_set;mobile_phone;fridge
123                                                                 motorcyle;bicycle;radio;sterio;cow_plough;solar_panel;table;mobile_phone
124                                                                         motorcyle;radio;sterio;cow_plough;solar_panel;table;mobile_phone
125                                                                                    radio;cow_plough;solar_panel;solar_torch;mobile_phone
126                                                               bicycle;television;radio;sterio;solar_panel;solar_torch;table;mobile_phone
127                                                                                                              motorcyle;radio;solar_panel
128                                  car;lorry;television;radio;sterio;cow_plough;solar_torch;electricity;table;sofa_set;mobile_phone;fridge
129                                                                                               radio;solar_panel;solar_torch;mobile_phone
130                    cow_cart;lorry;motorcyle;computer;television;radio;sterio;cow_plough;solar_panel;solar_torch;electricity;mobile_phone
131                                                                              radio;cow_plough;solar_panel;solar_torch;table;mobile_phone
    no_meals                               months_lack_food
1          2                                            Jan
2          2                           Jan;Sept;Oct;Nov;Dec
3          2                        Jan;Feb;Mar;Oct;Nov;Dec
4          2                               Sept;Oct;Nov;Dec
5          2                               Aug;Sept;Oct;Nov
6          2                                   Aug;Sept;Oct
7          3                                            Nov
8          2                                            Jan
9          3                                        Jan;Dec
10         3                                Jan;Oct;Nov;Dec
11         2                                        Oct;Nov
12         3                                       Sept;Oct
13         2                                   Sept;Oct;Nov
14         3                     June;July;Aug;Sept;Oct;Nov
15         2 Jan;Feb;Mar;Apr;May;June;July;Aug;Sept;Oct;Nov
16         3                                        Jan;Feb
17         2                                        Nov;Dec
18         2                                        Oct;Nov
19         3                                    Oct;Nov;Dec
20         2                                        Oct;Nov
21         2                        Jan;Feb;Mar;Oct;Nov;Dec
22         2           Jan;Feb;Mar;Apr;Aug;Sept;Oct;Nov;Dec
23         3                                           none
24         2                                        Nov;Dec
25         2                                    Jan;Feb;Oct
26         2                                           none
27         3                                           none
28         3                                   Aug;Sept;Oct
29         3                                        Jan;Feb
30         2                                        Jan;Feb
31         3                                           none
32         2                                           none
33         2                                           none
34         2                                        Jan;Dec
35         3                           Jan;Sept;Oct;Nov;Dec
36         3                                           none
37         3                                    Jan;Nov;Dec
38         3                                            Nov
39         3                                            Nov
40         3                                   Sept;Oct;Nov
41         3                                        Oct;Nov
42         3                                    Jan;Nov;Dec
43         2                            Jan;Feb;Oct;Nov;Dec
44         2                                        Jan;Dec
45         3                                           none
46         2                                   Sept;Oct;Nov
47         3                                           none
48         3                     June;July;Aug;Sept;Oct;Nov
49         3                                    Jan;Nov;Dec
50         2                 June;July;Aug;Sept;Oct;Nov;Dec
51         3                                        Oct;Nov
52         3                               Aug;Sept;Oct;Nov
53         2                                            Nov
54         2                                   Sept;Oct;Nov
55         2                                        Oct;Nov
56         3                                           none
57         2                                           none
58         2                                           none
59         2                                           none
60         2                                           none
61         3                                    Jan;Feb;Dec
62         3                               Aug;Sept;Oct;Nov
63         3                                Jan;Oct;Nov;Dec
64         3                                    Jan;Feb;Dec
65         3                                    Jan;Feb;Mar
66         3                                           none
67         3                                           none
68         3                                           none
69         3                                           none
70         2                                           none
71         2                               Aug;Sept;Oct;Nov
72         2                                   Aug;Sept;Oct
73         3                                    Jan;Oct;Nov
74         3                                           none
75         2                                        Oct;Nov
76         2                           Jan;Sept;Oct;Nov;Dec
77         3                                           none
78         3                                            Nov
79         3                                        Oct;Nov
80         3                                           none
81         3                                Jan;Feb;Nov;Dec
82         3                                           none
83         3                                           none
84         2                                   Sept;Oct;Nov
85         3                                           none
86         2                                            Nov
87         3                                            Nov
88         2                                    Oct;Nov;Dec
89         3                        Jan;Feb;Mar;Oct;Nov;Dec
90         2                       Jan;Aug;Sept;Oct;Nov;Dec
91         3                                   Jan;Sept;Oct
92         3                                           none
93         2                                   Aug;Sept;Oct
94         2                                        Oct;Nov
95         3                                        Oct;Nov
96         3                                   Sept;Oct;Nov
97         3                                    Jan;Feb;Dec
98         3                                        Jan;Feb
99         2                                   Aug;Sept;Oct
100        3                                           none
101        3                                    Jan;Feb;Dec
102        3                                    Jan;Feb;Dec
103        3                                    Oct;Nov;Dec
104        3                          July;Aug;Sept;Oct;Nov
105        2                                           none
106        3                                           none
107        3                                    Oct;Nov;Dec
108        3                           Jan;Sept;Oct;Nov;Dec
109        3                                           none
110        3                                           none
111        3                               Aug;Sept;Oct;Nov
112        3                                    Jan;Nov;Dec
113        3                                Jan;Feb;Nov;Dec
114        2                                           none
115        3                                        Jan;Dec
116        3                                   Sept;Oct;Nov
117        3                                   Sept;Oct;Nov
118        2                                            Nov
119        3                                           none
120        2                                        Feb;Mar
121        2                                    Jan;Nov;Dec
122        3                                    Jan;Feb;Dec
123        2                                Jan;Oct;Nov;Dec
124        3                                            Nov
125        2                                    Oct;Nov;Dec
126        3                                    Jan;Nov;Dec
127        3                                    Oct;Nov;Dec
128        3                                           none
129        3                                   Sept;Oct;Nov
130        3                                        Nov;Dec
131        3                                        Oct;Nov
                                   instanceID
1   uuid:ec241f2c-0609-46ed-b5e8-fe575f6cefef
2   uuid:099de9c9-3e5e-427b-8452-26250e840d6e
3   uuid:193d7daf-9582-409b-bf09-027dd36f9007
4   uuid:148d1105-778a-4755-aa71-281eadd4a973
5   uuid:2c867811-9696-4966-9866-f35c3e97d02d
6   uuid:daa56c91-c8e3-44c3-a663-af6a49a2ca70
7   uuid:ae20a58d-56f4-43d7-bafa-e7963d850844
8   uuid:d6cee930-7be1-4fd9-88c0-82a08f90fb5a
9   uuid:846103d2-b1db-4055-b502-9cd510bb7b37
10  uuid:8f4e49bc-da81-4356-ae34-e0d794a23721
11  uuid:d29b44e3-3348-4afc-aa4d-9eb34c89d483
12  uuid:e6ee6269-b467-4e37-91fc-5e9eaf934557
13  uuid:6c00c145-ee3b-409c-8c02-2c8d743b6918
14  uuid:9b21467f-1116-4340-a3b1-1ab64f13c87d
15  uuid:a837e545-ff86-4a1c-a1a5-6186804b985f
16  uuid:d17db52f-4b87-4768-b534-ea8f9704c565
17  uuid:4707f3dc-df18-4348-9c2c-eec651e89b6b
18  uuid:7ffe7bd1-a15c-420c-a137-e1f006c317a3
19  uuid:e32f2dc0-0d05-42fb-8e21-605757ddf07d
20  uuid:d1005274-bf52-4e79-8380-3350dd7c2bac
21  uuid:6570a7d0-6a0b-452c-aa2e-922500e35749
22  uuid:a51c3006-8847-46ff-9d4e-d29919b8ecf9
23  uuid:58b37b6d-d6cd-4414-8790-b9c68bca98de
24  uuid:661457d3-7e61-45e8-a238-7415e7548f82
25  uuid:45ed84c4-114e-4df0-9f5d-c800806c2bee
26  uuid:1c54ee24-22c4-4ee9-b1ad-42d483c08e2e
27  uuid:3197cded-1fdc-4c0c-9b10-cfcc0bf49c4d
28  uuid:1de53318-a8cf-4736-99b1-8239f8822473
29  uuid:adcd7463-8943-4c67-b25f-f72311409476
30  uuid:59341ead-92be-45a9-8545-6edf9f94fdc6
31  uuid:cb06eb49-dd39-4150-8bbe-a599e074afe8
32  uuid:25597af3-cd79-449c-a48a-fb9aea6c48bf
33  uuid:0fbd2df1-2640-4550-9fbd-7317feaa4758
34  uuid:14c78c45-a7cc-4b2a-b765-17c82b43feb4
35  uuid:ff7496e7-984a-47d3-a8a1-13618b5683ce
36  uuid:c90eade0-1148-4a12-8c0e-6387a36f45b1
37  uuid:408c6c93-d723-45ef-8dee-1b1bd3fe20cd
38  uuid:81309594-ff58-4dc1-83a7-72af5952ee08
39  uuid:c0fb6310-55af-4831-ae3d-2729556c3285
40  uuid:c0b34854-eede-4e81-b183-ef58a45bfc34
41  uuid:b3ba34d8-eea1-453d-bc73-c141bcbbc5e5
42  uuid:e3a1dd8a-1bda-428c-a014-2b527f11ae64
43  uuid:b4dff49f-ef27-40e5-a9d1-acf287b47358
44  uuid:f9fadf44-d040-4fca-86c1-2835f79c4952
45  uuid:e3554d22-35b1-4fb9-b386-dd5866ad5792
46  uuid:35f297e0-aa5d-4149-9b7b-4965004cfc37
47  uuid:2d0b1936-4f82-4ec3-a3b5-7c3c8cd6cc2b
48  uuid:e180899c-7614-49eb-a97c-40ed013a38a2
49  uuid:2303ebc1-2b3c-475a-8916-b322ebf18440
50  uuid:4267c33c-53a7-46d9-8bd6-b96f58a4f92c
51  uuid:18ac8e77-bdaf-47ab-85a2-e4c947c9d3ce
52  uuid:6db55cb4-a853-4000-9555-757b7fae2bcf
53  uuid:cc7f75c5-d13e-43f3-97e5-4f4c03cb4b12
54  uuid:273ab27f-9be3-4f3b-83c9-d3e1592de919
55  uuid:883c0433-9891-4121-bc63-744f082c1fa0
56  uuid:973c4ac6-f887-48e7-aeaf-4476f2cfab76
57  uuid:a7184e55-0615-492d-9835-8f44f3b03a71
58  uuid:a7a3451f-cd0d-4027-82d9-8dcd1234fcca
59  uuid:1936db62-5732-45dc-98ff-9b3ac7a22518
60  uuid:85465caf-23e4-4283-bb72-a0ef30e30176
61  uuid:2401cf50-8859-44d9-bd14-1bf9128766f2
62  uuid:c6597ecc-cc2a-4c35-a6dc-e62c71b345d6
63  uuid:86ed4328-7688-462f-aac7-d6518414526a
64  uuid:28cfd718-bf62-4d90-8100-55fafbe45d06
65  uuid:143f7478-0126-4fbc-86e0-5d324339206b
66  uuid:a457eab8-971b-4417-a971-2e55b8702816
67  uuid:6c15d667-2860-47e3-a5e7-7f679271e419
68  uuid:ef04b3eb-b47d-412e-9b09-4f5e08fc66f9
69  uuid:f86933a5-12b8-4427-b821-43c5b039401d
70  uuid:1feb0108-4599-4bf9-8a07-1f5e66a50a0a
71  uuid:761f9c49-ec93-4932-ba4c-cc7b78dfcef1
72  uuid:f6d04b41-b539-4e00-868a-0f62b427587d
73  uuid:429d279a-a519-4dcc-9f64-4673b0fd5d53
74  uuid:59738c17-1cda-49ee-a563-acd76f6bc487
75  uuid:7e7961ca-fa1c-4567-9bfa-a02f876e4e03
76  uuid:77b3021b-a9d6-4276-aaeb-5bfcfd413852
77  uuid:2186e2ec-f65a-47cc-9bc1-a0f36dd9591c
78  uuid:87998c33-c8d2-49ec-9dae-c123735957ec
79  uuid:ece89122-ea99-4378-b67e-a170127ec4e6
80  uuid:bf373763-dca5-4906-901b-d1bacb4f0286
81  uuid:394033e8-a6e2-4e39-bfac-458753a1ed78
82  uuid:268bfd97-991c-473f-bd51-bc80676c65c6
83  uuid:0a42c9ee-a840-4dda-8123-15c1bede5dfc
84  uuid:2c132929-9c8f-450a-81ff-367360ce2c19
85  uuid:44e427d1-a448-4bf2-b529-7d67b2266c06
86  uuid:85c99fd2-775f-40c9-8654-68223f59d091
87  uuid:28c64954-739c-444c-a6e0-355878e471c8
88  uuid:9e79a31c-3ea5-44f0-80f9-a32db49422e3
89  uuid:06d39051-38ef-4757-b68b-3327b1f16b9d
90  uuid:c4a2c982-244e-45a5-aa4b-71fa53f99e18
91  uuid:ac3da862-9e6c-4962-94b6-f4c31624f207
92  uuid:4178a296-903a-4a8e-9cfa-0cd6143476e8
93  uuid:a1e9df00-c8ae-411c-931c-c7df898c68d0
94  uuid:4d0f472b-f8ae-4026-87c9-6b5be14b0a70
95  uuid:b3b309c6-f234-4830-8b30-87d26a17ee1d
96  uuid:3c174acd-e431-4523-9ad6-eb14cddca805
97  uuid:e9d79844-ef14-493b-bbd6-d13691cc660e
98  uuid:76206b0b-af74-4344-b24f-81e839f0d7b0
99  uuid:da3fa7cc-5ce9-44fd-9a78-b8982b607515
100 uuid:a85df6df-0336-46fa-a9f4-522bf6f8b438
101 uuid:bb2bb365-7d7d-4fe9-9353-b21269676119
102 uuid:af0904ee-4fdb-4090-973f-599c81ddf022
103 uuid:468797c1-4a65-4f35-9c83-e28ce46972a2
104 uuid:602cd3f6-4a97-49c6-80e3-bcfd5c78dfa4
105 uuid:e7c51ac4-24e4-475e-88e7-f85e896945e3
106 uuid:01210861-aba1-4268-98d0-0260e05f5155
107 uuid:77335b2e-8812-4a35-b1e5-ca9ab626dfea
108 uuid:02b05c68-302e-4e7a-b229-81cb1377fd29
109 uuid:fa201fce-4e94-44b8-b435-c558c2e1ed55
110 uuid:628fe23d-188f-43e4-a203-a4bf3257d461
111 uuid:e4f4d6ba-e698-45a5-947f-ba6da88cc22b
112 uuid:cfee6297-2c0e-4f8a-94cc-9aaee0bd64cb
113 uuid:3fe626b3-c794-48e1-a80f-5bfe440c507b
114 uuid:0670cef6-d233-4852-89d8-36955261b0a3
115 uuid:9a096a12-b335-468c-b3cc-1191180d62de
116 uuid:92613d0d-e7b1-4d62-8ea4-451d7cd0a982
117 uuid:37577f91-d665-443e-8d70-b914954cef4b
118 uuid:f22831ec-6bc3-4b73-9197-4b01e01abb66
119 uuid:62f3f7af-f0f3-4f88-b9e0-acf8baa49ae4
120 uuid:40aac732-94df-496c-97ba-5b67f59bcc7a
121 uuid:a9d1a013-043b-475d-a71b-77ed80abe970
122 uuid:43ec6132-478c-4f87-878d-fb3c0c4d0c74
123 uuid:64fc743e-8176-40f6-8ae4-36ae97fac1d9
124 uuid:c17e374c-280b-4e78-bf21-74a7c1c73492
125 uuid:dad53aff-b520-4015-a9e3-f5fdf9168fe1
126 uuid:f94409a6-e461-4e4c-a6fb-0072d3d58b00
127 uuid:69caea81-a4e5-4e8d-83cd-9c18d8e8d965
128 uuid:5ccc2e5a-ea90-48b5-8542-69400d5334df
129 uuid:95c11a30-d44f-40c4-8ea8-ec34fca6bbbf
130 uuid:ffc83162-ff24-4a87-8709-eff17abc0b3b
131 uuid:aa77a0d7-7142-41c8-b494-483a5b68d8a7
safi$village
  [1] "God"      "God"      "God"      "God"      "God"      "God"     
  [7] "God"      "Chirodzo" "Chirodzo" "Chirodzo" "God"      "God"     
 [13] "God"      "God"      "God"      "God"      "God"      "God"     
 [19] "God"      "God"      "God"      "God"      "Ruaca"    "Ruaca"   
 [25] "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"   
 [31] "Ruaca"    "Ruaca"    "Ruaca"    "Chirodzo" "Chirodzo" "Chirodzo"
 [37] "Chirodzo" "God"      "God"      "God"      "God"      "God"     
 [43] "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo"
 [49] "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo"
 [55] "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo"
 [61] "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo"
 [67] "Chirodzo" "Chirodzo" "Chirodzo" "Chirodzo" "Ruaca"    "Chirodzo"
 [73] "Ruaca"    "Ruaca"    "Ruaca"    "God"      "Ruaca"    "God"     
 [79] "Ruaca"    "God"      "God"      "God"      "God"      "God"     
 [85] "God"      "God"      "God"      "God"      "God"      "Ruaca"   
 [91] "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "God"      "God"     
 [97] "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"   
[103] "God"      "God"      "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"   
[109] "Ruaca"    "Ruaca"    "God"      "Ruaca"    "Ruaca"    "Ruaca"   
[115] "Ruaca"    "Ruaca"    "God"      "God"      "Ruaca"    "Ruaca"   
[121] "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Ruaca"    "Chirodzo"
[127] "Ruaca"    "Ruaca"    "Ruaca"    "Chirodzo" "Chirodzo"

Factors

R has a special data class, called factor, to deal with categorical data that you may encounter when creating plots or doing statistical analyses. Factors are very useful and actually contribute to making R particularly well suited to working with data. So we are going to spend a little time introducing them.

Once created, factors can only contain a pre-defined set of values, known as levels. By default, R always sorts levels in alphabetical order. For instance, if you have a factor with 2 levels:

respondent_floor_type <- factor(c("earth", "cement", "cement", "earth"))
levels(respondent_floor_type)
[1] "cement" "earth" 
nlevels(respondent_floor_type)
[1] 2

Jika anda membutuhkan konversi dari faktor ke karakter, anda bisa menggunakan as.character().

as.character(respondent_floor_type)
[1] "earth"  "cement" "cement" "earth" 
year_fct <- factor(c(1990, 1983, 1977, 1998, 1990))

# coba jalankan perintah ini dengan menghilangkan tanda pagarnya
# as.numeric(year_fct)

Maka akan keluar output yang salah. Karena trpe factor tidak bisa langsung dikonversi ke numerik. Sehingga kita perlu untuk mengubahnya ke type karakter terlebih dahulu. Maka perintah yang benar adalah sebagai berikut:

as.numeric(as.character(year_fct))
[1] 1990 1983 1977 1998 1990

atau bisa juga menggunakan perintah

as.numeric(levels(year_fct))[year_fct]
[1] 1990 1983 1977 1998 1990

Renaming Factors

safi$memb_assoc
  [1] "NULL" "yes"  "NULL" "NULL" "NULL" "NULL" "no"   "yes"  "no"   "no"  
 [11] "NULL" "yes"  "no"   "NULL" "yes"  "NULL" "NULL" "NULL" "NULL" "NULL"
 [21] "no"   "NULL" "NULL" "no"   "no"   "no"   "NULL" "no"   "yes"  "NULL"
 [31] "NULL" "yes"  "no"   "yes"  "yes"  "yes"  "NULL" "yes"  "NULL" "yes" 
 [41] "NULL" "no"   "no"   "NULL" "no"   "no"   "yes"  "NULL" "NULL" "yes" 
 [51] "NULL" "no"   "yes"  "no"   "NULL" "yes"  "no"   "no"   "NULL" "no"  
 [61] "yes"  "NULL" "NULL" "NULL" "no"   "yes"  "no"   "no"   "no"   "no"  
 [71] "yes"  "NULL" "no"   "yes"  "NULL" "NULL" "yes"  "no"   "no"   "yes" 
 [81] "no"   "no"   "yes"  "no"   "yes"  "no"   "no"   "NULL" "yes"  "yes" 
 [91] "yes"  "yes"  "yes"  "no"   "no"   "no"   "no"   "yes"  "no"   "no"  
[101] "yes"  "yes"  "no"   "NULL" "no"   "no"   "NULL" "no"   "no"   "NULL"
[111] "no"   "NULL" "NULL" "no"   "no"   "no"   "no"   "yes"  "no"   "no"  
[121] "no"   "no"   "no"   "no"   "no"   "no"   "no"   "no"   "no"   "yes" 
[131] "NULL"
memb_assoc <- safi$memb_assoc
memb_assoc <- as.factor(memb_assoc)
memb_assoc
  [1] NULL yes  NULL NULL NULL NULL no   yes  no   no   NULL yes  no   NULL yes 
 [16] NULL NULL NULL NULL NULL no   NULL NULL no   no   no   NULL no   yes  NULL
 [31] NULL yes  no   yes  yes  yes  NULL yes  NULL yes  NULL no   no   NULL no  
 [46] no   yes  NULL NULL yes  NULL no   yes  no   NULL yes  no   no   NULL no  
 [61] yes  NULL NULL NULL no   yes  no   no   no   no   yes  NULL no   yes  NULL
 [76] NULL yes  no   no   yes  no   no   yes  no   yes  no   no   NULL yes  yes 
 [91] yes  yes  yes  no   no   no   no   yes  no   no   yes  yes  no   NULL no  
[106] no   NULL no   no   NULL no   NULL NULL no   no   no   no   yes  no   no  
[121] no   no   no   no   no   no   no   no   no   yes  NULL
Levels: no NULL yes
plot(memb_assoc)

Formating Dates

#install.packages('lubridate')
library(lubridate)
dates <- safi$interview_date
str(dates)
 chr [1:131] "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" ...

Membuat kolom baru yang berisi day,month, year.

safi$day <- day(dates)
safi$month <- month(dates)
safi$year <- year(dates)
str(safi)
'data.frame':   131 obs. of  17 variables:
 $ key_ID              : int  1 1 3 4 5 6 7 8 9 10 ...
 $ village             : chr  "God" "God" "God" "God" ...
 $ interview_date      : chr  "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" "2016-11-17T00:00:00Z" ...
 $ no_membrs           : int  3 7 10 7 7 3 6 12 8 12 ...
 $ years_liv           : int  4 9 15 6 40 3 38 70 6 23 ...
 $ respondent_wall_type: chr  "muddaub" " muddaub" " burntbricks" " burntbricks" ...
 $ rooms               : int  1 1 1 1 1 1 1 3 1 5 ...
 $ memb_assoc          : chr  "NULL" "yes" "NULL" "NULL" ...
 $ affect_conflicts    : chr  "NULL" "once" "NULL" "NULL" ...
 $ liv_count           : int  1 3 1 2 4 1 1 2 3 2 ...
 $ items_owned         : chr  "bicycle;television;solar_panel;table" "cow_cart;bicycle;radio;cow_plough;solar_panel;solar_torch;table;mobile_phone" "solar_torch" "bicycle;radio;cow_plough;solar_panel;mobile_phone" ...
 $ no_meals            : int  2 2 2 2 2 2 3 2 3 3 ...
 $ months_lack_food    : chr  "Jan" "Jan;Sept;Oct;Nov;Dec" "Jan;Feb;Mar;Oct;Nov;Dec" "Sept;Oct;Nov;Dec" ...
 $ instanceID          : chr  "uuid:ec241f2c-0609-46ed-b5e8-fe575f6cefef" "uuid:099de9c9-3e5e-427b-8452-26250e840d6e" "uuid:193d7daf-9582-409b-bf09-027dd36f9007" "uuid:148d1105-778a-4755-aa71-281eadd4a973" ...
 $ day                 : int  17 17 17 17 17 17 17 16 16 16 ...
 $ month               : num  11 11 11 11 11 11 11 11 11 12 ...
 $ year                : num  2016 2016 2016 2016 2016 ...

Latihan

  1. Import data SAFI_clean.csv ke dalam R dan tampilkan 10 baris pertama menggunakan fungsi yang sesuai.

  2. Gunakan fungsi summary() untuk mendapatkan ringkasan statistik deskriptif dari data yang telah diimpor.

  3. Tampilkan struktur data menggunakan str(). Apa tipe data dari kolom interview_date dan liv_count?

  4. Hitung jumlah observasi dan variabel dalam data safi menggunakan fungsi yang sesuai.

  5. Tampilkan elemen pertama dari kolom pertama dalam dataframe safi.

  6. Ambil seluruh data kecuali kolom key_ID.

  7. Tampilkan semua data untuk desa “Ruaca” saja.

  8. Pilih hanya kolom village, no_membrs, dan liv_count dari dataset.

  9. Konversi kolom memb_assoc menjadi tipe data faktor.

  10. Berapa jumlah level unik pada faktor tersebut?

  11. Ubah nama level NULL menjadi Unknown pada kolom memb_assoc.

  12. Hitung frekuensi masing-masing level pada faktor memb_assoc.

  13. Buat kolom baru bernama house_age yang merupakan hasil pengurangan tahun 2023 dengan years_liv.

  14. Hitung rata-rata jumlah anggota keluarga (no_membrs) untuk setiap desa (village).

  15. Berapa rata-rata liv_count untuk rumah yang memiliki lebih dari 2 kamar (rooms > 2)?

  16. Filter data untuk rumah tangga yang memiliki lebih dari 5 anggota keluarga dan lebih dari 3 ternak (liv_count > 3).

  17. Buat plot batang untuk melihat distribusi kepemilikan asosiasi (memb_assoc).

  18. Buat histogram untuk variabel liv_count.

  19. Buat scatter plot untuk melihat hubungan antara no_membrs dan liv_count.

  20. Tambahkan warna berdasarkan desa (village) pada scatter plot yang telah dibuat.

  21. Ekstrak tahun, bulan, dan hari dari kolom interview_date.

  22. Hitung berapa banyak wawancara yang dilakukan pada tahun 2017.

  23. Urutkan data berdasarkan tanggal wawancara (interview_date) dari yang paling lama ke yang terbaru.

  24. Filter data untuk menampilkan rumah yang memiliki lebih dari 3 anggota keluarga dan lebih dari 2 kamar tidur.

  25. Buat pivot table sederhana untuk menghitung rata-rata no_meals berdasarkan village.

  26. Hitung persentase rumah tangga yang mengalami kekurangan makanan (months_lack_food tidak kosong) dibandingkan total data.

  27. Gunakan ggplot2 untuk membuat boxplot yang menunjukkan distribusi liv_count berdasarkan village.

  28. Buat heatmap untuk menganalisis korelasi antar variabel numerik di dataset.