square <- matrix(byrow = TRUE, nrow = 6L, c(
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 0, 0, 0,
0, 1, 0, 0, 1, 1, 1, 0,
0, 1, 0, 0, 1, 0, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0
))
square_blur <- blur(square)
image(t(square))
image(t(square_blur))
Run the code above in your browser using DataLab