====== Merging frequency distributions ====== > addFreq <- function(P,Q){ + if(length(Q)==0) return(P) + H <- c(); sent <- "zzzzzzzzzzz" + N <- c(names(P),sent); M <- c(names(Q),sent); + n <- length(P); m <- length(Q); i <- 1; j <- 1 + while((i t1 <- "Analytics in a Big Data World: The Essential Guide to Data Science and Its Applications" > t2 <- "Data Science for Business: What You Need to Know about Data Mining and Data-Analytic Thinking" > separator <- "([[:punct:]]|[[:space:]]|”|“|—|‘|’)+" > f1 <- table(unlist(strsplit(tolower(t1),separator))) > f1 a analytics and applications big data essential 1 1 1 1 1 2 1 guide in its science the to world 1 1 1 1 1 1 1 > f2 <- table(unlist(strsplit(tolower(t2),separator))) > f2 about analytic and business data for know mining need science 1 1 1 1 3 1 1 1 1 1 thinking to what you 1 1 1 1 > f12 <- addFreq(f1,f2) > f12 a about analytic analytics and applications big 1 1 1 1 2 1 1 business data essential for guide in its 1 5 1 1 1 1 1 know mining need science the thinking to 1 1 1 2 1 1 2 what 1