xapply function

Apply a function to ranges of variables