demo                  package:utils                  R Documentation

_D_e_m_o_n_s_t_r_a_t_i_o_n_s _o_f _R _F_u_n_c_t_i_o_n_a_l_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     'demo' is a user-friendly interface to running some demonstration
     R scripts.  'demo()' gives the list of available topics.

_U_s_a_g_e:

     demo(topic, package = NULL, lib.loc = NULL,
          character.only = FALSE, verbose = getOption("verbose"),
          echo = TRUE, ask = getOption("demo.ask"))

_A_r_g_u_m_e_n_t_s:

   topic: the topic which should be demonstrated, given as a name or
          literal character string, or a character string, depending on
          whether 'character.only' is 'FALSE' (default) or 'TRUE'.  If
          omitted, the list of available topics is displayed.

 package: a character vector giving the packages to look into for
          demos, or 'NULL'.  By default, all packages in the search
          path are used.

 lib.loc: a character vector of directory names of R libraries, or
          'NULL'.  The default value of 'NULL' corresponds to all
          libraries currently known.  If the default is used, the
          loaded packages are searched before the libraries.

character.only: logical; if 'TRUE', use 'topic' as character string.

 verbose: a logical.  If 'TRUE', additional diagnostics are printed.

    echo: a logical.  If 'TRUE', show the R input when sourcing.

     ask: a logical (or '"default"') indicating if
          'devAskNewPage(ask=TRUE)' should be called before graphical
          output happens from the demo code.  The value '"default"'
          (the factory-fresh default) means to ask if 'echo == TRUE'
          and the graphics device appears to be interactive.  This
          parameter applies both to any currently opened device and to
          any devices opened by the demo code.

_D_e_t_a_i_l_s:

     If no topics are given, 'demo' lists the available demos.  The
     corresponding information is returned in an object of class
     '"packageIQR"'.  The structure of this class is experimental.  In
     earlier versions of R, an empty character vector was returned
     along with listing available demos.

_S_e_e _A_l_s_o:

     'source' and 'devAskNewPage' which  are called by 'demo'.

_E_x_a_m_p_l_e_s:

     demo() # for attached packages

     ## All available demos:
     demo(package = .packages(all.available = TRUE))

     ## Display a demo, pausing between pages
     demo(lm.glm, package="stats", ask=TRUE)

     ## Display it without pausing
     demo(lm.glm, package="stats", ask=FALSE)

     ## Not run: 
      ch <- "scoping"
      demo(ch, character = TRUE)
     ## End(Not run)

     ## Find the location of a demo
     system.file("demo", "lm.glm.R", package="stats")

