nth function

Extract the first, last or nth value from a vector