R/create_union.R

Defines functions create.union

Documented in create.union

#' @export
create.union<-function(channel, export){

  channel.tables <- grep(channel, names(export), value = TRUE, ignore.case = TRUE)
  output <- data.frame()

  for (channel.table in channel.tables) {
    if (channel.table == "fb.video.export" | channel.table == "tw.video.export")
      next
    output <- rbind.fill(output, export[[channel.table]]@table)
  }

  if (dim(output)[1] > 0) {
    if (!("Channel" %in% names(output))) {
      output$Channel <- channel
    }
    output <- get.paid.organic(output)
  }

  output
}
omelyanchikd/merger documentation built on July 13, 2017, 6:24 p.m.