Sorry for this simple question, I did not find a suitable solution for this in my search. I would like to create a new column in my data frame and fill it with random numbers from 1 to 100 (may repeat).
Below is the code I'm currently using,
data$newrow <- rep(1:100,replace=T, nrow(data))
I get this error:
Error in `$<-.data.frame`(`*tmp*`, "newrow", value = c(1L, 2L, : replacement has 2088800 rows, data has 20888`
Can you help me fix my code?
source share