R MissingArrayIndexException