pdb <philb <at> philbrierley.com> writes: > > > Hi, > > Here is what I need to generate... > > 1 x > 2 z > 3 z > 4 y > > Any pointers would be appreciated. > > Regards, > this should work, probably other options are possible a <- data.frame(x = rnorm(4), y = rnorm(4), z = rnorm(4)) z<-apply(a,1,which.max) names(a)[z]