Broke the cardinal rule of not using for loops in R, but here's a solution:
input_dat <- data.frame(ID=c(1,2,3,4),
Name=c("aa","bb","cc","dd"),
Amount=c(1500,2000,1000,500))
# For row 1 and 2, limit 250
# For row 3+, limit 500
limit <- c(250,250,500)
output_dat <- data.frame(ID=NULL, Name=NULL, Amount=NULL)
for (i in 1:nrow(input_dat)) {
total <- input_dat$Amount[i]
iter <- 1
while (total > 0) {
total <- total - limit[iter]
output_dat <- rbind(output_dat,
data.frame(ID=input_dat$ID[i],
Name=input_dat$Name[i],
Amount=limit[iter]))
# If you get to the last value in limit, stop incrementing
if (iter < length(limit))
iter <- iter + 1
}
}