
Hallo,

The command:

x <- 3
mat <- as.matrix(expand.grid(rep(list(0:1), x)))

generates a matrix with 2^x columns containing the binary representations
of the decimals from 0 to (2^x-1), here from 0 to 7. But the rows are not
sorted in this order.

How can sort the rows the ascending order of the decimals they represent,
preferably without a function which converts binaries to decimals (which I
have)? Alternatively, generate a matrix that has the rows sorted that way?

Thanks,
Serguei
	[[alternative HTML version deleted]]

