lundi 3 juillet 2023

Error assigning random rank using random() and row_number in R

I am trying to replicate the analysis made here Three Strategies for Working with Big Data in R, chunk-by-chunk. When i get to the part of sampling the data, i type

df_mod <- df %>% group_by(is_delayed) %>% mutate(x = random() %>% row_number()) %>% ungroup()

and as result i get the error :

Error in mutate(): i In argument: x = random() %>% row_number(). i In group 1: is_delayed = FALSE. Caused by error in random(): ! could not find function "random"

Is the random function part of an external package? I did load the library suggested by the article author with no success.

I would be glad to receive any insights of yo all.

Thank you!

As described above, the code returns an error that i have not yet experienced.




Aucun commentaire:

Enregistrer un commentaire