Created
February 20, 2018 07:22
-
-
Save chao1224/cf9ec33356dc7b9319c3cdd9ae925d6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = 5 | |
c = 10 | |
matrix_ = matrix(0, r, c) | |
assign <- function(matrix_, r, c){ | |
count = 1 | |
for (i in 1:r) { | |
for (j in 1:c) { | |
matrix_[i,j] = count | |
count = count + 1 | |
} | |
} | |
return(matrix_) | |
} | |
matrix_ <- assign(matrix_, r, c) | |
args = commandArgs(trailingOnly = TRUE) | |
index = as.numeric(args[1]) | |
#print(index) | |
complete_index = c(1, 2, 3, 4, 5, 6, 7, 8) | |
temp_index = combn(8, 4) | |
print(temp_index) | |
temp_index = temp_index[, index] | |
print(matrix_[, temp_index]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment