Learn R Programming

WebAnalytics (version 0.9.13)

plotErrorRateByHour: Plots rates of HTTP response code groups by hour

Description

Generates a stacked bar plot of http response code types (2xx Success, 3xx Redirect, 4xx User Error and 5xx System Error) by hour.

The x-axis is hours and the plot is limited to 24 axis labels (optimally this is one day) regardless of how many days are being reported. This ensures that the labels are readable.

Usage

plotErrorRateByHour(dataFrame)

Value

Returns a ggplot2 plot. This function is intended to be wrapped in a call to plotSaveGG

Arguments

dataFrame

a transaction data frame created by logFileRead or logFileListRead

Author

Greg Hunt <greg@firmansyah.com>

See Also

logFileRead logFileListRead

Examples

Run this code
# \dontshow{
datd = paste0(tempdir(),"/minconfigtemp")
unlink(datd)
dir.create(paste0(tempdir(),"/minconfigtemp"))
logfile = paste0(datd,"/log.log")
fileConn = gzfile(system.file("extdata", "compressed.log", package = "WebAnalytics"))
writeLines(readLines(fileConn,n=100),con=logfile)
close(fileConn)
# set the files directory name suitable for an R example
configVariableSet("config.workdir", tempdir())
setDTthreads(threads = 1)
# }
logFileName = logFileNamesGetLast(dataDirectory=datd, 
  directoryNames=c(".", "."), 
  fileNamePattern="*[.]log")[[1]]

cols = logFileFieldsGetIIS(logFileName)

logdf = logFileRead(logFileName, columnList=cols, 
            logTimeZone = "", timeFormat = "")

plotErrorRateByHour(logdf) 

Run the code above in your browser using DataLab