0

I have this dataframe

DF    
     V1      
1.   123     
2.   12      
3.   12345       

when I use the code

max(nchar(DF$V1))

I get

[1] 5

But I would like to know which row has the longest string, something like

[3]

Any suggestion on how to do this?

Thanks

Nnnz
  • 55
  • 6

1 Answers1

0

How about

which.max(nchar(DF$V1))

or which(nchar(DF$V1) == max(nchar(DF$V1)))?

WhatIf
  • 626
  • 4
  • 10