The code you posted will not run because nrow_i is not defined. I set it to zero at the top of the for loop and found that the while loop only executes once for every value of i. I showed this by added a counter variable j that increments with each iteration of the while loop. In the following reprex, you can see that j is always 1, ctotal_i is always > 15 and nrow_i is always > 5.
From your description of the task, it seems the tests of the while loop should be c1_i + c2_i + c3_i > 15 || nrow_i > five, so that the loop will keep running until ctotal_i < 15 and nrow_i < 5. However, it might take a long time to meet both conditions. In 100 iterations, the minimum ctotal_i was 16.9 and the minimum nrow_i was 8. The chances of getting both below the thresholds seems very low.
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.2
five = as.integer(5)
list_results <- list()
for (i in 1:100){
c1_i = c2_i = c3_i = ctotal_i = 0
nrow_i <- 0
j <- 0
while(c1_i + c2_i + c3_i < 15 && nrow_i < five ) {
j <- j+1
num_1_i = sample_n(iris, 30)
num_2_i = sample_n(iris, 30)
num_3_i = sample_n(iris, 30)
c1_i = mean(num_1_i$Sepal.Length)
c2_i = mean(num_2_i$Sepal.Length)
c3_i = mean(num_3_i$Sepal.Length)
ctotal_i = c1_i + c2_i + c3_i
combined_i = rbind(num_1_i, num_2_i, num_3_i)
nrow_i = nrow(unique(combined_i[duplicated(combined_i), ]))
}
inter_results_i <- data.frame(i, c1_i, c2_i, c3_i, ctotal_i, nrow_i,j)
list_results[[i]] <- inter_results_i
}
sapply(list_results,function(DF) DF$j)
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
min(sapply(list_results,function(DF) DF$ctotal_i))
#> [1] 16.91667
min(sapply(list_results,function(DF) DF$nrow_i))
#> [1] 8
Created on 2022-07-04 by the reprex package (v2.0.1)