comments             package:RGoogleDocs             R Documentation

_Q_u_e_r_y _e_l_e_m_e_n_t_s _o_f _w_o_r_d _p_r_o_c_e_s_s_i_n_g _d_o_c_u_m_e_n_t

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

     These functions allow the caller to retrieve the values of certain
     types of elements within a Google word processing document. These
     elements are the referenced images,  the names of the sections,
     the footnotes and the comments.  One can fetch the values of these
     elements or alternatively the HTML/XML nodes in which they are
     contained. This is useful if one wants to modify the contents of
     the document.

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

     comments(doc, con, asNodes = FALSE)
     images(doc, con, full.names = FALSE, asNodes = FALSE)
     footnotes(doc, con, asNodes = FALSE)
     sections(doc, con, asNodes = FALSE)

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

     doc: the document to be queried. This can be the name of the
          document, a '"GoogleDocument"' returned as an element from a
          call to 'getDocs', or a parsed HTML document (using
          native/internal nodes).

     con: the authenticated connection to the Google Docs API. See
          'getGoogleDocsConnection'.

 asNodes: a logical value indicating whether to return the nodes
          corresponding to the  items rather than their contents.

full.names: a logical value indicating whether to give the full names
          or the  relative names of image files. If this is 'TRUE', the
          values are (or will be!) expanded relative to the name of the
          document, i.e. if the document is  

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

     These functions return either a character vector or a data.frame,
     or if 'asNodes' is 'TRUE' then a list of the corresponding nodes.

     'comments' returns a data frame with a row for each comment and
     three columns: text, date and author's name. The date is of class
     POSIXct.

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

     Duncan Temple Lang

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

     'readDoc' 'getGoogleDocsConnection'

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

     if((tmp <- Sys.getenv("GOOGLE_DOCS_PASSWORD")) != "") {
       tmp = strsplit(tmp, "=")[[1]]
       assign("GoogleDocsPassword", structure(tmp[2], names = tmp[1]), globalenv())
     }

     if(exists("GoogleDocsPassword")) {
           # getGoogleDocsConnection("my login", "my password")

        con = getGoogleDocsConnection(names(GoogleDocsPassword), GoogleDocsPassword)
        images("Many Parts", con)
        comments("Many Parts", con)

        docs = getDocs(con)
        sections(docs[["Many Parts"]], con)

          # If we want to parse the document just once and then 
          # get the elements without having to go back to Google
          # each time to download the document.
        hdoc = htmlParse(getDocContent("Many Parts", con), asText = TRUE, error = function(...){})
        comments(hdoc)
        images(hdoc)
        sections(hdoc)
        footnotes(hdoc)
     }

