"rbind" recombination - Combine ddf divisions by row binding
combRbind(...)
additional attributes to define the combiner (currently only used internally)
combRbind
is passed to the argument combine
in recombine
divide
, recombine
, combDdo
, combDdf
, combCollect
, combMeanCoef
, combMean
# NOT RUN {
# Create a distributed data frame using the iris data set
bySpecies <- divide(iris, by = "Species")
# Create a function that will calculate the standard deviation of each
# variable in in a subset. The calls to 'as.data.frame()' and 't()'
# convert the vector output of 'apply()' into a data.frame with a single row
sdCol <- function(x) as.data.frame(t(apply(x, 2, sd)))
# Combine the results using rbind
combined <- recombine(addTransform(bySpecies, sdCol), combine = combRbind)
class(combined)
combined
# A more concise (and readable) way to do it
bySpecies %>%
addTransform(sdCol) %>%
recombine(combRbind)
# }
Run the code above in your browser using DataLab