I am stuck for quite a while now and really interested in how to achieve this. so I a have a dataframe and I want to add another column with random numbers between 1 and the number that is in that row under the column 'Amount'. How can i do this? this is what i have now:
dataframe$newColumn <- sample(1:30, nrow(dataframe), replace = T)
but i dont want it to go from 1 to 30, but rather have the number in 'Amount' column as the max.
Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire