I am looking at a specific use case where I would like to split a number into parts by a number that it is getting divided by
For example : 42/8 = 8, 8, 8, 8, 8, 2 or 68/8 = 8, 8, 8, 8, 8, 8, 8, 8, 4
>Solution :
You could do…
a <- 42
b <- 8
paste(c(rep(b, a %/% b), a %% b), collapse = ",")
[1] "8,8,8,8,8,2"
Or don’t use the paste() if you just want a vector of numbers.