matrix with frame in r

how do i Write a function that gets an integer d, and outputs a matrix of size d × d. The matrix should be all zeros, exept its frame?

this is what iv`e tried

matrix(data = rep(0:1), nrow = 4, ncol = 4, byrow = TRUE, )

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.