How have you checked the number of rows in the .csv file?
We need reproducible example (reprex)
I just tried exporting a 5,000,000 data.frame to .csv with no problem but it was a very simple one. See the example below.
dat1 <- data.frame(kk = sample(letters, 5000000, replace = TRUE),
zz = sample(1:10, 5000000, replace = TRUE) )
write.csv(dat1, "millions.csv", row.names = FALSE)