dimanche 28 mai 2017

In R, how to find the index of the value sampled?

In R, I would like to know how I can find the index/indices of the value(s) sampled, for examaple using function sample.

In Matlab, it appears this is quite easily done by requesting output argument idx in function datasample. Explictly, taken from Matlab's documentation page for function datasample:

[y,idx] = datasample(data,k,...) returns an index vector indicating which values datasample sampled from data.

I would like to know if such a thing can be accomplished in R, and how.




Aucun commentaire:

Enregistrer un commentaire