R/zipf.fnc.R

`zipf.fnc` <-
function(text, plot = FALSE) {
  spectrum = spectrum.fnc(text)
  spectrum = spectrum[nrow(spectrum):1,]
  spectrum$rank = cumsum(spectrum$freqOfFreq)
  if (plot) 
    plot(log(spectrum$rank), log(spectrum$frequency), 
      xlab = "log rank", ylab = "log frequency", 
      type = "S")
  return(spectrum)
}

Try the languageR package in your browser

Any scripts or data that you put into this service are public.

languageR documentation built on May 30, 2017, 3:09 a.m.