read.table.url             package:base             R Documentation

_R_e_a_d _D_a_t_a _a_n_d _C_o_d_e _f_r_o_m _a _U_R_L

_D_e_s_c_r_i_p_t_i_o_n:

     Extensions of `read.table', `scan', `source' and `file.show' to
     read text files on a remote  server.

_U_s_a_g_e:

     read.table.url(url, method = "auto",...)
     scan.url(url, file = tempfile(), method = "auto", ...)
     source.url(url, file = tempfile(), method = "auto", ...)
     url.show(url, title = url, file = tempfile(),
              delete.file = TRUE, method = "auto", ...)

_A_r_g_u_m_e_n_t_s:

     url: The URL to read from

  method: File transfer method: see `download.file'

     ...: Arguments to pass to `read.table', `scan', `source' or
          `file.show'.

    file: File to copy to.

delete.file: Delete the file afterwards?

_D_e_t_a_i_l_s:

     These functions call `download.file' to create a temporary local
     file. The file can be downloaded by `lynx' or `wget' if these are
     available on the system. Another option is a direct `HTTP' socket
     connection, if the local machine allows this.

_V_a_l_u_e:

     The same value as the respective file-based functions.

_S_e_e _A_l_s_o:

     `read.table', `scan', `source', `make.socket', `read.socket',
     `file.show',`download.file'

_E_x_a_m_p_l_e_s:

     read.table.url("http://lib.stat.cmu.edu/jcgs/tu",
        skip=4, header=TRUE)
     url.show("http://lib.stat.cmu.edu/datasets/csb/ch11b.txt")
     beaver<-read.table.url("http://lib.stat.cmu.edu/datasets/csb/ch11b.dat",
       col.names=c("obsnum","day","time","temperature","activity"), row.names=1)
     # the next two examples will only work if socket connections to
     # statlib are allowed from your site.
     url.show("http://lib.stat.cmu.edu/datasets/csb/ch3a.txt",
                       method="socket")
     ozone<-read.table.url("http://lib.stat.cmu.edu/datasets/csb/ch3a.dat",
       col.names=c("date","day.cts","day.passive","night.cts","night.passive"),
       na.strings=".", method="socket")

