turned on flat screen monitor

The way to Import Excel Recordsdata into R (Step-by-Step)

Posted on
banner 336x280


One of the best ways to import an Excel report into R is through the use of the read_excel() serve as from the readxl package deal.

banner 468x60

This serve as makes use of refer to syntax:

read_excel(trail, sheet = NULL)

the place:

  • trail: Trail to the xls/xlsx report
  • sheet: The sheet to learn. This may also be the title of the sheet or the location of the sheet. If this isn’t specified, the primary sheet is learn.

This instructional supplies an instance of how you can importance this serve as to import an Excel report into R.

Instance: Import an Excel Record into R

Assume I’ve an Excel report stored in refer to location:

C:\Customers\Bob\Desktop\knowledge.xlsx

The report accommodates refer to knowledge:

Import Excel into R

Please see code presentations how you can import this Excel report into R:

#set up and cargo readxl package deal
set up.applications('readxl')
library(readxl)

#import Excel report into R
knowledge <- read_excel('C:\\Customers\\Bob\\Desktop\\knowledge.xlsx')

Observe that we worn double backslashes (\\) within the report trail to steer clear of refer to regular error:

Error: '\U' worn with out hex digits in personality fibre forming ""C:\U"

We will importance refer to code to briefly view the knowledge:

#view whole dataset
knowledge

#A tibble: 5 x 3
 staff  issues  assists
 <chr>   <dbl>   <dbl>
1 A         78      12
2 B         85      20
3 C         93      23
4 D         90       8
5 E         91      14

We will see that R imported the Excel report and mechanically ambitious that staff used to be a fibre variable day issues and assists had been numerical variables.

Alternative Sources

Please see tutorials provide an explanation for how you can import alternative report varieties into R:

The way to Import CSV Recordsdata into R
The way to Import SAS Recordsdata into R
The way to Manually Input Uncooked Knowledge in R

banner 336x280

Leave a Reply

Your email address will not be published. Required fields are marked *