I would like to convert the following for loop into a functional Scala method.
for (i <- 15 to 25){
count_table_rdd = count_table_rdd.union(training_data.map(line => (i+"_"+line(i)+"_"+line(0), 1)).reduceByKey(_ + _))
}
I have tried look at the foreach method, but I do not want to transform every item, just 15 through 25.
slice(from:Int, to:Int)method on them, so if you could slice and thenforeachyou could be all setiin your actual use case? Or justline(i)?