<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-import-a-csv-to-an-r-notebook/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.datazar.com/how-to-import-a-csv-to-an-r-notebook-16291c28496e?source=rss----e2c7e6e1c75--r_language"> R Language in Datazar Blog on Medium</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Adding a file to your R notebook is a simple 2 step process.</p>
<h4><strong>1. “Import” file to notebook session</strong>.</h4>
<p>This makes sure your dataset is isolated in one state so that it doesn’t change as you analyze it. Remember, you can always load the latest content if you choose to later on.</p>
<p>To import the file, click on the “Load Files” button in your notebook. That will list all the files available for import from your current project.</p>
<figure><img alt="" src="https://i0.wp.com/cdn-images-1.medium.com/max/1024/1*RIrn621eVLp3x1RprfHoYw.png?w=456&ssl=1" data-recalc-dims="1"><figcaption>Dialog box for importing file.</figcaption></figure>
<p>Click on the button next to the file (on the left). Once it’s loaded into the notebook session, the button will turn green.</p>
<figure><img alt="" src="https://i0.wp.com/cdn-images-1.medium.com/max/1024/1*MM4WWqhniJWtlSeTOBgmDw.png?w=456&ssl=1" data-recalc-dims="1"><figcaption>File loaded.</figcaption></figure>
<h4>2. Reading the file.</h4>
<p>We can now read the CSV dataset using the read.csv() function that comes with R.</p>
<figure><img alt="" src="https://i0.wp.com/cdn-images-1.medium.com/max/1024/1*igpHwTwbiYwJnaRjLpkOoA.png?w=456&ssl=1" data-recalc-dims="1"><figcaption>Reading the file into the notebook and dispaying the top to check.</figcaption></figure>
<p>And that’s it! The head() function allows you to see the first few lines of the dataset. That way we can check if it has been loaded. You can now use the dataset variable to access the entire CSV dataset.</p>
<p>All files from this post are located here so you can copy them and run again: <a rel="nofollow" href="https://www.datazar.com/project/p820a77e6-1555-4549-8a6f-96ca99c29ff8/files" target="_blank">https://www.datazar.com/project/p820a77e6-1555-4549-8a6f-96ca99c29ff8/files</a></p>
<p><img width="1" src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16291c28496e" height="1"></p>
<hr>
<p><a rel="nofollow" href="https://blog.datazar.com/how-to-import-a-csv-to-an-r-notebook-16291c28496e" target="_blank">How to Import a CSV to an R Notebook</a> was originally published in <a rel="nofollow" href="https://blog.datazar.com/" target="_blank">Datazar Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</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://blog.datazar.com/how-to-import-a-csv-to-an-r-notebook-16291c28496e?source=rss----e2c7e6e1c75--r_language"> R Language in Datazar Blog on Medium</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/zPNiQOefTTs" height="1"></a></div>