mardi 26 septembre 2023

Generating random dataframes (5 rows 9 cols) with each rowsum should be 9

I'm trying to create 10 or more of pseudo dataframes. The data frame dim should be 9 columns with 5 rows(Mon, Tue,Wed, Thur, Fri), and each rowsum should be 9. like below.

        Factor1 Factor2 Factor3 Factor4 Factor5 Factor6 Factor7 Factor8 Factor9
Mon       2       1       0       2       0       0       1       1       2
Tue       1       1       1       1       0       0       2       1       2
Wed       2       1       0       2       1       1       1       1       0
Thu       0       0       1       1       3       0       2       2       0
Fri       1       0       0       1       1       0       2       2       2

How can I generate multiple dataframes that meet the condition, please?




Aucun commentaire:

Enregistrer un commentaire