<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/how-to-read-an-excel-file-into-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.displayr.com/how-to-read-an-excel-file-into-r/?utm_medium=Feed&utm_source=Syndication"> R – Displayr</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2>Installing R package</h2>
<p>Because <span>flipAPI</span> does not require external libraries that use Java or Perl, installation is very straightforward. Simply open R and type the following into the console:</p>
<pre>
install.package(devtools)
devtools::install_github(&quot;Displayr/flipAPI&quot;)
</pre>
<p>Once the <span>flipAPI</span> package is installed, a file can be read in by using the command</p>
<pre>
library(flipAPI)
DownloadXLSX(filename)
</pre>
<h2>Data output format</h2>
<p>In many cases, the Excel format contains multiple tables with comments and other text. It is not necessary to reformat the file before importing. We can specify particular sheets or ranges to import.</p>
<pre>
cola1 = DownloadXLSX(&quot;https://wiki.q-researchsoftware.com/images/b/b9/Cola_Discriminant_Functions.xlsx&quot;, want.col.names = TRUE, range = &quot;A2:G9&quot;)
cola2 = DownloadXLSX(&quot;https://wiki.q-researchsoftware.com/images/b/b9/Cola_Discriminant_Functions.xlsx&quot;, want.col.names = TRUE, want.row.names = FALSE, sheet = 2, range = &quot;AB2:AC330&quot;
</pre>
<p>To check the result of these command, we type</p>
<pre>
str(cola1)
</pre>
<p>and see the output:</p>
<pre> num [1:7, 1:6] -3.4 2.653 -0.566 -0.458 -0.428 ...
 - attr(*, &quot;dimnames&quot;)=List of 2
  ..$ : chr [1:7] &quot;Intercept&quot; &quot;Coca-Cola&quot; &quot;Diet Coke&quot; &quot;Coke Zero&quot; ...
  ..$ : chr [1:6] &quot;Coca-Cola&quot; &quot;Diet Coke&quot; &quot;Coke Zero&quot; &quot;Pepsi&quot; ...
</pre>
<p>Similarly, we type <span>str(cola2)</span> and get output:</p>
<pre>'data.frame':	328 obs. of  2 variables:
 $ Highest Score           : num  1.1202 1.8786 1.8311 3.6638 0.0754 ...
 $ Predicted Preferred Cola: Factor w/ 6 levels &quot;Coca-Cola&quot;,&quot;Coke Zero&quot;,..: 6 6 3 1 3 6 2 1 3 2 ...
</pre>
<p>We can see that <span>DownloadXLSX</span> automatically parses and converts the data into the correct format. <span>cola1</span>, which contains only numeric data, is converted into a matrix, whereas <span>cola2</span>, which has both numeric and categorical data, is converted into a data frame.</p>
<h2>Importing Excel files from cloud storage</h2>
<p>Another useful feature of <span>DownloadXLSX</span>, which is not supported by the <span>readxl</span> package, is that it can read Excel files directly from the URL. If your file is in cloud storage — such as Dropbox, One Drive or Google Drive — you can simply use the link to that file instead of downloading a copy. Note that most links provided by cloud storage services do not take you directly to the file but instead to a page that shows a preview in your browser. <span>DownloadXLSX</span> will try to get the direct link automatically; however, this is supported only for Dropbox, One Drive and Google Drive.</p>
<p> </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.displayr.com/how-to-read-an-excel-file-into-r/?utm_medium=Feed&utm_source=Syndication"> R – Displayr</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/VvNVHHwxKSE" height="1"></a></div>