R/cdf.R

#' Plot CDF of the names variable
#'
#' @return Returns standard fast-analysis structured list
#' @name cdfPlot
#' @family skeletonPlots
NULL

#' @rdname cdfPlot
#' @export
udpLatencyCDF <- function() {
    save <- 'udp_latency_cdf'
    data <- pullUDPExpanded()
    process <- udpLatencyMelt()
    plot <- paste("\n#### UDP Latency CDF",
                  "
plt <- ggplot(udpLatencyMelt[udpLatencyMelt$variable == 'latency_median',],
			  aes(x = value,
			  	color = carrier)) +
	stat_ecdf() +
	theme_root() +
    scale_color_root() +
	xlab('Latency (ms)') +
	ylab('') +
    scale_y_continuous(labels = percent)
print(plt)
",
                  saveLine(save),
                  sep = "")
    output <- list(data = data,
                   process = process,
                   plot = plot,
                   save = save)
    return(output)
}


#' @rdname cdfPlot
#' @export
udpLatencySizeCDF <- function() {
    save <- 'udp_latency_size_cdf'
    data <- pullUDPExpanded()
    process <- udpLatencyMelt()
    plot <- paste("\n#### UDP Latency CDF by Size Class",
                  "
plt <- ggplot(udpLatencyMelt[grepl(udpLatencyMelt$variable, pattern = 'latency_median_'),],
			  aes(x = value,
			  	color = carrier)) +
	stat_ecdf() +
	theme_root() +
    scale_color_root() +
	xlab('Latency (ms)') +
	ylab('') +
    scale_y_continuous(labels = percent) +
    facet_wrap(~ variable, scale = 'free_x')
print(plt)
",
                  saveLine(save),
                  sep = "")
    output <- list(data = data,
                   process = process,
                   plot = plot,
                   save = save)
    return(output)
}


#' @rdname cdfPlot
#' @export
udpDropCDF <- function() {
    save <- 'udp_droprate_cdf'
    data <- pullUDPExpanded()
    process <- udpDropMelt()
    plot <- paste("\n#### UDP Drop Rate CDF",
                  "
plt <- ggplot(udpDropMelt[udpDropMelt$variable == 'avg_packet_drop',],
			  aes(x = value,
			  	color = carrier)) +
	stat_ecdf() +
	theme_root() +
    scale_color_root() +
	xlab('Drop Rate') +
	ylab('') +
    scale_y_continuous(labels = percent)
print(plt)
",
                  saveLine(save),
                  sep = "")
    output <- list(data = data,
                   process = process,
                   plot = plot,
                   save = save)
    return(output)
}


#' @rdname cdfPlot
#' @export
udpDropSizeCDF <- function() {
    save <- 'udp_droprate_size_cdf'
    data <- pullUDPExpanded()
    process <- udpDropMelt()
    plot <- paste("\n#### UDP Drop Rate CDF by Size Class",
                  "
plt <- ggplot(udpDropMelt[grepl(udpDropMelt$variable, pattern = 'avg_packet_drop_'),],
			  aes(x = value,
			  	color = carrier)) +
	stat_ecdf() +
	theme_root() +
    scale_color_root() +
	xlab('Drop Rate') +
	ylab('') +
    scale_y_continuous(labels = percent) +
    facet_wrap(~ variable, scale = 'free_x')
print(plt)
",
                  saveLine(save),
                  sep = "")
    output <- list(data = data,
                   process = process,
                   plot = plot,
                   save = save)
    return(output)
}
mlhutchins/fast-analytics documentation built on May 23, 2019, 2:10 a.m.