samedi 12 juin 2021

Which of the given elements of a data frame is biger in R

I need to specify which of the given elements is bigger if it's in the first row return "T" and if the second return "F" eg.

    A  B  C  D  E 
1   5  1  3  6  3
2   4  0  1  8  6

I need the output to be in a list like

A "T"
B "T"
C "T"
D "F"
E "F"

I tried something like

if_else(data[1,]>data[2,],'T','F')

But it doesn't seem to work

Aucun commentaire:

Enregistrer un commentaire