Hie,
I am trying to combine a two level variables to create a third variable (strata). The first level is region (north, central, south) the second one is MTYPE of dwelling (1=rural , 2=urban). I wish to combine these so that I have a six level variable (North1, North2, Central1, Central2 or Northrural, Northurban etc).
a snippet of my data
data.frame(stringsAsFactors=FALSE,
Zn_gdl = c(59.375, 56.25, 50, 53.125, 93.75, 68.75),
znadj = c(59.375, 59.05237961148, 50, 55.7716918552867,
99.3951300710933, 68.75),
status = c("low", "low", "low", "low", "ok", "ok"),
CRP = c(4.97, 19.23, 1.19, 13.29, 5.03, 0.84),
AGP = c(0.65, 1.56, 0.61, 1.07, 0.8, 0.44),
inflst = c("A_norm", "earl", "A_norm", "earl", "incu", "A_norm"),
time_blood_draw = c(1, 1, 1, 2, 1, 2),
fast = c(0, 0, 0, 0, 0, 0),
gender = c("M", "M", "M", "M", "M", "M"),
group = c("men", "men", "men", "men", "men", "men"),
MCLUSTER = c(601, 601, 601, 511, 511, 829),
MNUMBER = c(289, 151, 9, 94, 95, 234),
M01 = c(2, 2, 1, 2, 1, 1),
unadjstatus = c("low", "low", "low", "low", "ok", "ok"),
wgt = c(0.995193, 0.995193, 0.995193, 1.117896, 1.117896,
1.477476),
MREGION = c(2, 2, 3, 2, 1, 3),
region = c("central", "central", "south", "central", "north",
"south"),
strata = c(NA, NA, NA, NA, NA, NA),
MTYPE = as.factor(c("2", "1", "1", "2", "2", "2"))
)
I have spent a few hours trying different functions such as combine.levels and mutate but keep going in circles and not getting what I want. Can anyone help?