Hi @shinhm91,
Welcome to the RStudio Community Forum.
I think you will have to post an example of what the object datlist contains before we can troubleshoot this problem. Maybe make a Reproducible Example, and show what output is required: https://forum.posit.co/t/welcome-to-the-rstudio-community/8
You are asking aaply() to do calculations on dimensions 2 and 3, whereas as.matrix() will only produce a 2D object (or am I missing something?).