serializeEnv            package:annotate            R Documentation

_A _F_u_n_c_t_i_o_n _T_o _S_e_r_i_a_l_i_z_e _E_n_v_i_r_o_n_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     This function will serialize an environment in R to an XML format
     stored in a compressed file.

_U_s_a_g_e:

     serializeEnv(env, fname)
     serializeDataPkgEnvs(pkgDir)

_A_r_g_u_m_e_n_t_s:

     env: The name of the environment to serialize.

   fname: The name of the output file.

  pkgDir: The directory where a data package is

_D_e_t_a_i_l_s:

     The environment is converted into an XML format and then outputted
     to a gzipped file (using 'gzfile').  The values in the environment
     are serialized (using 'serialize') in ASCII format although the
     keys are stored in plain text.

     The format of the XML is very simple, with the primary block being
     'values', which contain blocks of 'entries', and each entry having
     a 'key' and a 'value'.  For instance, if we had an environment
     with one value in it, the character 'c' with a key of 'a' (e.g.
     'assign("a", "c", env=foo)'), this is what the output would look
     like.


          <?xml version="1.0"?>
          <values xmlns:bt="http://www.bioconductor.org/RGDBM">
             <entry>
                <key>
                  a
                </key>
                <value>
                   A\n2\n131072\n66560\n1040\n1\n1033\n1\nc\n
                </value>
             </entry>    
          </values>


_A_u_t_h_o_r(_s):

     Jeff Gentry

_S_e_e _A_l_s_o:

     'gzfile', 'serialize'

_E_x_a_m_p_l_e_s:

        z <- new.env()
        assign("a", 1, env=z)
        assign("b", 2, env=z)
        assign("c", 3, env=z)
        serializeEnv(z, tempfile())

