I have to create a function that takes a data frame and makes it a square, symmetric data frame such that if the number of rows exceeds the number of columns, drop the first x number of rows such that the number of rows equals the number of columns (I have to do this vice-versa too).
For example, I need:
> df
a b c
a 1 2 3
b 4 5 6
to look like:
> df
b c
a 2 3
b 5 6
Thanks.
Aucun commentaire:
Enregistrer un commentaire