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)
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
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
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.
ReplyDeleteThis article is not about how to import data from Excel into R. You can check out this link -
DeleteImport Data into R
Great and very helpful work, thanks a lot
ReplyDeleteLove your work. Thank you very much.
ReplyDeletewow this is so simple and fantastic. didn't know you can do that.
ReplyDelete