itemFrequencyPlot           package:arules           R Documentation

_C_r_e_a_t_i_n_g _a _I_t_e_m _F_r_e_q_u_e_n_c_i_e_s/_S_u_p_p_o_r_t _B_a_r _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Provides the generic function 'itemFrequencyPlot' and the S4
     method to create an item frequency bar plot for inspecting the
     item frequency distribution for objects based on 'itemMatrix'
     (e.g., 'transactions', or items in 'itemsets' and 'rules').

_U_s_a_g_e:

     itemFrequencyPlot(x, ...)
     ## S4 method for signature 'itemMatrix':
     itemFrequencyPlot(x, type = c("relative", "absolute"), 
         support = NULL, topN = NULL,
         population = NULL, popCol = "black", popLwd = 1,
         lift = FALSE, horiz = FALSE, 
         names = TRUE, cex.names =  par("cex.axis"), 
         xlab = NULL, ylab = NULL, mai = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: the object to be plotted.

     ...: further arguments are passed on (see   'barplot' from
          possible arguments).

    type: a character string indicating whether  item frequencies
          should be displayed  relative of absolute.

 support: a numeric value. Only display items which have a support of 
          at least 'support'. If no population is given, support is
          calculated  from 'x' otherwise from the population. Support
          is interpreted relative or absolute according to the setting
          of 'type'.

    topN: a integer value. Only plot the 'topN'  items with the highest
          item frequency or lift (if 'lift = TRUE'). The items are
          plotted ordered by descending support. 

population: object of same class  as 'x'; if 'x' is a segment of a
          population, the population mean frequency for each item can
          be shown as a line in the plot.

  popCol: plotting color for population.

  popLwd: line width for population.

    lift: a logical indicating whether to plot the lift ratio between
          instead of frequencies. The lift ratio is gives how many
          times an item is more frequent in 'x' than in 'population'.

   horiz: a logical. If 'horiz = FALSE' (default),  the bars are drawn
          vertically. If 'TRUE', the bars are drawn horizontally.

   names: a logical indicating if the names (bar labels) should be 
          displayed?

cex.names: a numeric value for the expansion factor for axis names (bar
          labels).

    xlab: a character string with the label for the x axis  (use an
          empty string to force no label).

    ylab: a character string with the label for the y axis (see xlab).

     mai: a numerical vector giving the plots margin sizes in inches
          (see `? par').

_V_a_l_u_e:

     A numeric vector with the midpoints of the drawn bars; useful for
     adding to the graph.

_S_e_e _A_l_s_o:

     'itemFrequency', 'itemMatrix-class'

_E_x_a_m_p_l_e_s:

     data(Adult)

     ## the following example compares the item frequencies
     ## of people with a large income (boxes) with the average in the data set
     Adult.largeIncome <- Adult[Adult %in% 
             "income=large"]

     ## simple plot
     itemFrequencyPlot(Adult.largeIncome)

     ## plot with the averages of the population plotted as a line 
     ## (for first 72 variables/items)
     itemFrequencyPlot(Adult.largeIncome[, 1:72], 
             population = Adult[, 1:72])

     ## plot lift ratio (frequency in x / frequency in population)
     ## for items with a support of 20% in the population
     itemFrequencyPlot(Adult.largeIncome, 
             population = Adult, support = 0.2, 
             lift = TRUE, horiz = TRUE)

