[SPARKR-146] Support read/save object files in SparkR.

We should pull the logic of minSplits into a function as it is used by both textFile and objectFile