First, I have four variables distribuited in columns, coded "0,1", each "1" is the TRUE value con the condition, I need to label each "1", get all those in a columns and make an histogram that show the data with the labels.
I've been working with "Ethnic identification" variable , there are four possible options: "MAYA", "LADINO", "GARIFUNA", "XINKA", "EXTRANJERO"; in my base each option is in a different column with "0,1", I've tried to change those "1s" for different values as follows: "MAYA=1", "LADINO=2", "GARIFUNA=3" etc., to differenciate each value but i got lost in what to do next.
#ID_ETNICO<- CAPITAL
class(ID_ETNICO):
$ IEE_MAYA : int 1 0 0 0 1 1 0 1
$ IEE_LADINO : int 0 1 0 0 0 0 1 0
$ IEE_GARIFUNA : int 0 0 1 0 0 0 0 0
$ IEE_XINKA : int 0 0 0 1 0 0 0 0
$ IEE_EXTRANJERO : int 0 0 0 0 0 0 0 0
ID_ETNICO$IEE_LADINO[ID_ETNICO$IEE_LADINO=="1"] <- 2
ID_ETNICO$IEE_GARIFUNA[ID_ETNICO$IEE_GARIFUNA=="1"] <- 3
ID_ETNICO$IEE_XINKA[ID_ETNICO$IEE_XINKA=="1"] <- 4
ID_ETNICO$IEE_EXTRANJERO[ID_ETNICO$IEE_EXTRANJERO=="1"] <- 5
$IEE_MAYA : int 1 0 0 0 1 1 0
$ IEE_LADINO : num 0 2 0 0 0 0 2
$ IEE_GARIFUNA : num 0 0 3 0 0 0 0
$ IEE_XINKA : num 0 0 0 4 0 0 0
$ IEE_EXTRANJERO : num 0 0 0 0 0 0 0
table(ID_ETNICO$IEE_MAYA)
table(ID_ETNICO$IEE_LADINO)
table(ID_ETNICO$IEE_GARIFUNA)
table(ID_ETNICO$IEE_XINKA)
table(ID_ETNICO$IEE_EXTRANJERO)
table(ID_ETNICO$IEE_MAYA)
0 1
27533 5263
table(ID_ETNICO$IEE_LADINO)
0 2
6354 26442
table(ID_ETNICO$IEE_GARIFUNA)
0 3
32593 203
table(ID_ETNICO$IEE_XINKA)
0 4
32649 147
table(ID_ETNICO$IEE_EXTRANJERO)
0 5
32576 220
Now, I need to label "1=MAYA", "2=LADINO", "3=GARIFUNA", "4=XINKA", "5=EXTRANJERO", merge in a single column and obtain the frequencies of each label and make a histogram.