I have an excel file that is stored on http:..../test.xls, how do i import this file into R ?
I tried using the gdata package but it requires Perl and I cannot install Perl on my office machine.
I have an excel file that is stored on http:..../test.xls, how do i import this file into R ?
I tried using the gdata package but it requires Perl and I cannot install Perl on my office machine.
When you installed R there were several documents that installed with it (one way to see these docs is run the command help.start()
). One of these documents is called "R Data Import/Export", section 9 of that document is titled "Reading Excel Spreadsheets" and it gives multiple options along with some discussion of what requirements there are for each.
You could use readxl
(installation instruction here)
The
readxl
package makes it easy to get data out of Excel and into R. Compared to many of the existing packages (e.g.gdata
,xlsx
,xlsReadWrite
) readxl has no external dependencies so it's easy to install and use on all operating systems. It is designed to work with tabular data stored in a single sheet.
Note: As per mentionned by @Spacedman, you may have to download the file first using download.file
or your favorite Curl package.
You could also use jentjr's fork which adds URL capability to readxl
by using download.file
internally:
devtools::install_github("jentjr/readxl")
library(readxl)
idem_url <- "http://www.in.gov/idem/files/groundwater_gwmn_data_2008.xls"
gw <- read_excel(idem_url)