R: creating a new column filled with random numbers
Sorry for this simple question, I haven't found a fitting solution for
this in my search. I'd like to create a new column in my data frame and
fill it with random numbers between 1 to 100 (can repeat).
Below is the code I'm currently using,
data$newrow <- rep(1:100,replace=T, nrow(data))
I receive 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?
No comments:
Post a Comment