numericindex function

Convert character or logical indices to numeric