jeudi 1 juin 2023

Randomly selecting 50 columns in R data table results in table with only 50 rows. How can I fix this?

I'm trying to randomly select 50 columns in a data table in R (the original table has 110 columns and 1000+ rows). But when I run the code, the resulting table only has 50 rows (I am not trying to filter out the rows, only the columns).

randomTable = sample_n(ogTable, 50, axis = 'columns')

I looked up this issue and it seems like this function doesn't display all rows if it exceeds the number of resulting columns, but I could not find a way to get around this.




Aucun commentaire:

Enregistrer un commentaire