R functions for analyzing baseball data from major databases