[r] How to test if list element exists?