[R] R: how to do this?

Luca Braglia braglia at poleis.eu
Fri Sep 11 11:42:35 CEST 2009


> Da: Linlin Yan [mailto:yanlinlin82 at gmail.com]
> Inviato: venerdì 11 settembre 2009 11.19
> A: Luca Braglia
> Cc: r-help at r-project.org
> Oggetto: Re: [R] how to do this?
> 
> Try this:
> > y[matrix(c(seq_along(x), x), ncol = 2)]
> [1]  2 16 12


Very interesting! 

So I can give as index to a data.frame a matrix (of index) too
(not only vectors separated by commas). 

Thank you




More information about the R-help mailing list