Thank you everyone for your helpful feedback. I found the issue which was the section on datatable(rv$mtcars[1:min,1:3]. If the "min" variable is larger than the total number of rows after transposing, the DT rows will disappear entirely. I thought I had accounted for this through the line min<-min(paste(length(colnames(rv$data))), paste(length(rownames(rv$data)))) but I believe that by using "paste", this number was incorrectly calculated and the actual minimum was not correct. By removing "paste" from the calculation, the number was calculated correctly. I was not able to replicate this with mtcars so I don't know the exact cause. But at least the issue is solved.