gtable               package:gWidgets               R Documentation

_C_o_n_s_t_r_u_c_t_o_r _f_o_r _w_i_d_g_e_t _t_o _d_i_s_p_l_a_y _t_a_b_u_l_a_r _d_a_t_a

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

     This widget displays either a vector, matrix or data frame in a
     tabular format. The main usage is for user selection of a row or
     rows.

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

     gtable(items, multiple = FALSE, chosencol = 1, icon.FUN = NULL, filter.column = NULL, filter.labels = NULL, filter.FUN = NULL, handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())

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

   items: A vector, matrix or data frame to be displayed. A vector and
          matrix is coerced into a data frame.

multiple: A logical. If 'TRUE' multiple lines can be selected

chosencol: By default, only the value in this column is returned by the
          'svalue' method.

icon.FUN: If given, this function is applied to the data frame to be
          shown. It should return a vector of stock icon names

filter.column: If not 'NULL' a filter by droplist is given which can be
          used to filter the displayed values shown using the values in
          this column.

filter.labels: If filtering is desired, but by a more complicated means
          that just a columns value, then these labels are used for the
          drop list. These are used by 'filter.FUN'

filter.FUN: A function with signature '(obj, filter.by)' to specify a
          vector of logical values indicating which rows should be
          shown.

 handler: Called on a double click event

  action: Passed to handler

container: Optional container to attach widget to

     ...: ignored 

 toolkit: Which GUI toolkit to use

_D_e_t_a_i_l_s:

     When no filtering is requested, the column headers can be clicked
     to sort the values.

     The 'svalue' method returns the selected value(s). By default,
     only the value(s) in the chosen column are returned. Use the
     argument 'drop=FALSE' to return the entire row. To return the row
     index, use the argument 'index=TRUE'. When filtering is being
     used, this index refers to the entire data frame, not just the
     visible data frame.

     The '"["' notion treats the object like a data frame. When
     filtering or sorting, this notation refers to the entire data
     frame, not the visible or rearranged data frame.

     Assignment via '"[<-"' may be used. In gWidgetsRGtk there are
     limitations. The number of columns may not be reduced. Assignment
     with both row and column indices missing may be needed for some
     desired actions.

     As with data frames, the data type of a variable is important. In
     particular,  assignment with '"[<-"' for factors can cause
     warnings if the values are not in the factor's levels. When the
     value being assigned is a matrix there is a coercion to a data
     frame which may change the type.

     The 'visible' and 'visible<-' methods refer to which rows of the
     data store are visible in the widget. These are specified by a
     vector of class logical. This may be used when there is filtering,
     not sorting.

     The 'dim' method returns the dimension of the data frame.

     The 'dimnames' method works, although you can't see the rownames,
     you can  assigne to column names, although 'names' is more
     convenient.

     A single click is used for selection of a value. 

     The 'addhandlerdoubleclick' handler responds to a double click
     event.

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

     See also 'gtree' for displaying tree-like data and 'gdf' for
     tabular data meant to be edited

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

     ## Not run: 
       icon.FUN = function(df) {
         x = rep("file", length = length(df$isdir))
         x[df$isdir] = "directory"
         x
       }
       files = file.info(dir())
       files = cbind(rownames(files), files[,c("size","isdir")])
       names(files)[1] = "Filename"
       gtable(files, icon.FUN=icon.FUN, container=TRUE)
     ## End(Not run)

