How To Write If Statement In R