I’m interpreting your question to be about getting row numbers.
- You can try
as.numeric(rownames(df))if you haven’t set the rownames. Otherwise use a sequence of1:nrow(df). - The
which()function converts a TRUE/FALSE row index into row numbers.
I’m interpreting your question to be about getting row numbers.
as.numeric(rownames(df)) if you haven’t set the rownames. Otherwise use a sequence of 1:nrow(df). which() function converts a TRUE/FALSE row index into row numbers.