I guess you could achieve the rq-decompostion like this: ## Transpose and permute pt <- function(A){n <- nrow(A);t(A)[n:1,n:1]} ## pt(A)=QR ==> A=pt(R)pt(Q) rq <- function(A){ qr <- qr(pt(A)) list(Q=pt(qr.Q(qr)),R=pt(qr.R(qr))) } ## Test it A <- matrix(rnorm(25),5) Q <- rq(A)$Q R <- rq(A)$R range(R%*%Q-A) Best regards Kasper Kristensen