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]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to