How To Import An Excel File Into R
How To Import An Excel File Into R
R (example included)
To import an Excel file into R using the readxl package:
library("readxl")
print(df)
library("readxl")
print(df)
steps to Import an Excel file Into R
Copy
install.packages("readxl")
You may want to check the following guide that explains how
to install a package in R.
Step 3:
Import the Excel file into R
In order to import your file, you’ll need to use the following template
in the R Editor:
Copy
library("readxl")
print(df)
C:\\Users\\Ron\\Desktop\\Test\\product_list.xlsx
Where:
Here is the complete code to import the Excel file for our example:
Copy
library("readxl")
df = read_excel("C:\\Users\\Ron\\Desktop\\Test\\
product_list.xlsx")
print(df)
You’ll need to adjust the path to reflect the location where the Excel
file is stored on your computer.
Once you run the code in R, you’ll get the same values as in the
Excel file:
Product Price
1 Refrigerator 1200
2 Oven 750
3 Dishwasher 900