I am completely new to any kind of coding, nevermind R in particular, so my days of googling have not been very helpful. I would really appreciate any kind of help/insights!
I would like to know how to get two new variables out of the original variable, and attach new values to it - basically I start with this:
and want to obtain this:
I managed to get it in long format with melt(dataname, id.vars=c("ID"))
and the ID & value I get are good. But there is only one variable with my four headers (loudHot, quietHot, loudCold, quietCold) repeated - how do I create two new variables out of this and assign the values to it (e.g. that "Volume" has the value 1 when the original variable is loudHot or loudCold and 0 if its quietHot or quietCold, and then "Temp" is 1 when the original variable is loudHot or quietHot and 0 when its loudCold or quietCold)?