Created
October 7, 2016 13:14
-
-
Save kebbbnnn/b56498f7a194557ea3700c62cd734e90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
f3 <- function(m){ | |
for(i in 1:nrow(m)){ | |
for(j in 1:ncol(m)){ | |
m[i,j] = if(m[i,j] %% 2 != 0) m[i,j]*2 else m[i,j] | |
} | |
} | |
return(m) | |
} | |
N <- matrix(c(c(1,5,-2),c(1,2,-1),c(3,6,-3)), ncol = 3, nrow = 3) | |
print(N) | |
print(f3(N)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment