Copy Data from Excel to R

This tutorial explains how we can create data in MS Excel and paste it to R syntax editor window to create a table in R. MS Excel is one of the most frequently used tools in analytics industry. Many companies have switched their core analytics work from Excel to R / SAS but we still find some of the data in excel file.

If you prefer to import excel file to R rather than copying and paste excel data to R, you can check out this tutorial - Importing Data to R

Step 1 :  Prepare Data in Excel

Step 2 : Paste Data under text= "   " section of read,table (See the image below)

Prepare Data in Excel and Paste it to R Editor

data = read.table(text="
X Y Z
6 5 0
6 3 NA
6 1 5
8 5 3", header=TRUE)

It creates 3 columns - X, Y and Z. The header = TRUE tells R to consider first row as header.

Related Data : Import Data into R
About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 8 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Telecom and Human Resource.

Related Posts:
5 Responses to "Copy Data from Excel to R"
  1. This somehow doesn't seem correct. Instead of giving location like C:\Documents\Folder\xyz.xlsx\Sheet1$A1:$D6. The example given doesn't seem from copy data from excel to R.

    ReplyDelete
    Replies
    1. This article is not about how to import data from Excel into R. You can check out this link -
      Import Data into R

      Delete
  2. It is really a great work and the way in which you are sharing the knowledge is excellent.Thanks for your informative article
    Ms excel training in chennai

    ReplyDelete
  3. Great and very helpful work, thanks a lot

    ReplyDelete
  4. Love your work. Thank you very much.

    ReplyDelete

We have Zero Tolerance to Spam. Comments with links will be deleted immediately upon our review.

Next → ← Prev
Love this Post? Spread the Word!
Share