R script plus some resulst if else fail