I have a vector which contains certain words
colors<-c("Yellow","Blue","Red")
> colors
[1] "Yellow" "Blue" "Red"
Now I want to create a new variable, colorsCombined, in which the original vector is present and also all possible combinations of those words.
> colorsCombined
[1] "Yellow", "Blue", "Red", "YellowBlue", "YellowRed", "BlueRed", "YellowBlueRed"
I consider YellowBlue to be the same as BlueYellow.
How do I do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…