r - Finding index of a first NON-NA for a specific column in data frame -


i have data frame multiple columns. of data missing (na). sorted data frame 1 column, , data sorted na's sorted last values. want index of last non-na value.

column1 column2 1       2 2       na 3       data 4       data na      data na      data na      data 

so want index of 4. tried

which(is.na(df)) 

but doesn't seem return na values.

it appears want expression:

max(which(complete.cases(df$column1))) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -