Displaying 1 result from an estimated 1 matches for "mood1".
Did you mean:
mood
2013 Feb 07
4
help with creating new variables using a loop
Hi there,
I've got a set of 10 numeric variables called Mood1 to Mood10 in a dataset called mood. I'm trying to create a set of 10 new variables called m1 to m10 so that m1=Mood1*1, m2=Mood2*2, etc to m10=Mood10*10
Trawling through the internet, I eventually tried the following code:
for (i in 1:10){
assign(x=paste0("mood$m",i),
va...