I made the following code:
NovelID <- NULL x <- 1 while(x < 25) { if(length(NovelID) < 25) { NovelID <- c(NovelID, SalesList$BookID[Sal