I have a dataframe `data`

in R of dim 102500 rows by 41 columns.

Each 41 lines is a frame measured at different time intervals (ie 2500 frames). I need to do heatmap in each data frame, and at the end visualize it as a 3D to show each layer separably by going through the layers.

I tried this matrix to split my data:

m1 <- matrix(1:(41*2500*41), nrow=41*2500, ncol=41)

lst <- lapply(split(seq_len(nrow(m1)),(seq_len(nrow(m1))-1) %/%41 +1),

function(i) m1[i,])

arr1 <- array(0, dim=c(41,41,2500))

for(i in 1:2500){

arr1[,,i] <- lst[[i]]

}

dfs <- split(data,arr1)

for (p in dfs) { print(dfs$p) }

for (p in dfs){

NeatMap::heatmap1(as.matrix(p))

but it is not working properly.

Do you have any suggestion for me to define my x, y, and z axis to split my data frame and visualize it as a 3D at the end?

This code is working properly for one data frame:

NeatMap::heatmap1(data[1:41,])

But it will takes forever if I want to manually split the data, and create heat map for each of them!