HTMLStart               package:R2HTML               R Documentation

_S_t_a_r_t / _S_t_o_p  _t_h_e _a_u_t_o_m_a_t_i_c _r_e_d_i_r_e_c_t_i_o_n _o_f _o_u_t_p_u_t _t_o _H_T_M_L _f_i_l_e_s

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

     Add the automatic redirection of output to an HTML file. The R
     session is modified in the following way: a new prompt is proposed
     (by default HTML>) and each parsed command is also evaluated using
     'HTML' generic method, so that the user benefits of both a normal
     and a HTML output.  Please read carefully the details below.

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

     HTMLStart(outdir = tempdir(), filename = "index", extension = "html", echo = FALSE, autobrowse = FALSE, HTMLframe = TRUE, withprompt = "HTML> ", CSSFile = "R2HTML.css", BackGroundColor = "FFFFFF", BackGroundImg = "", Title = "R output") 
     HTMLStop()

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

  outdir: physical directory to store the output 

filename: name of the target HTML main file 

extension: extension of the target HTML file (htm, html,...) 

    echo: should the parsed commands be written in the output?
          [boolean] 

autobrowse: 

HTMLframe: should the output have a HTML frame structure? [boolean]

withprompt: prompt to display while using HTMLStart/HTMLStop

 CSSFile: path and name of a CSS file to use 

BackGroundColor: option bgcolor for HTML tag <body>

BackGroundImg: option background for HTML tag <body>

   Title: string to pass to HTML <title> tag  

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

     The user may need to know the following points which describe how
     R2HTML does work:

     - Each parsed command is evaluated and the returned value is
     passed to the generic function HTML. This evaluation is assured by
     addTaskCallback function, which is used to add a specific task
     each time R has to parse an expression. 

     - A new environment called HTMLenv is build, where internal
     variables such as physical path are stored. This environment is
     not visible by the user. It is destroyed when calling 'HTMLStop'.

     - Inside the HTMLenv environment, a special variable may be of
     interest: '.HTML.file', which contains the path to the default
     HTML target file. User should modify this variable, at his own
     risks.

     - For internal uses, functions 'fix' and 'plot.new' are temporary
     replaced, by assigning them in your primary environment. Those
     copies are deleted when calling 'HTMLStop'. If you close your
     session before calling 'HTMLStop', you will have to erase those
     function manually. If not, you may encounter troubles when editing
     a function or making a graph, as R2HTML functions refer to the
     environment HTMLenv...

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

     no useful output is returned.

_N_o_t_e:

     The argument 'echo' is very usefull for teaching purpose.

_A_u_t_h_o_r(_s):

     Eric Lecoutre

_R_e_f_e_r_e_n_c_e_s:

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

     'HTML'

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

     # Perform's one's own direct report

     dir.create(file.path(tempdir(),"R2HTML"))
     HTMLStart(file.path(tempdir(),"R2HTML"),HTMLframe=FALSE, Title="My report",autobrowse=FALSE)
     as.title("This is my first title")
     x <- 1
     y<- 2
     x+y
     HTMLStop()

     ## Use for interactive teaching course
     if (interactive()){
             dir.create(file.path(tempdir(),"R2HTML"))
             HTMLStart(file.path(tempdir(),"R2HTML"),echo=TRUE)
             as.title("Manipulation vectors")
             1:10
             sum(1:10)
             c(1:10,rep(3,4))
             HTMLStop()
     }

