get_attr function

Extract attribute. Returns NA if none