Hello,

 

 

Assuming that I have a data frame 

A<-data.frame(A=c(10,100,1000,30,50,60,300),

              B=c(0,1,1,1,0,0,0),                        

              C=c(0,0,0,0,1,1,0),

              D=c(1,0,0,0,0,0,1))

 

What I would like is to introduce a new column Variable such that:

 

A<-data.frame(A=c(10,100,1000,30,50,60,300),

              B=c(0,1,1,1,0,0,0),                        

              C=c(0,0,0,0,1,1,0),

              D=c(1,0,0,0,0,0,1),

       Variable=c(D,B,B,B,C,C,D)) 

 

How can I do it?

 

Best 

IOanna


	[[alternative HTML version deleted]]

