\'order\' in R seems like \'sort\' in Stata. Here\'s a dataset for example (only variable names listed):
v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v
It is very unclear what you would like to do, but your first sentence makes me assume you would like to sort dataset.
Actually, there is a built-in order function, which returns the indices of the ordered sequence. Are you searching this?
order
> x <- c(3,2,1) > order(x) [1] 3 2 1 > x[order(x)] [1] 1 2 3