In this article, we will discuss how to import an excel file in the R Programming Language. There two different types of approaches to import the excel file into the R programming language and those are discussed properly below.
File in use:
Method 1: Using read_excel()
In this approach to import the Excel file in the R, the user needs to call the read_excel() function from readxl library of the R language with the name of the file as the parameter. With the use of this function, the user will be able to import the Excel file in R.
Syntax: read_excel(filename, sheet, dtype = “float32”)
- filename:-File name to read from.
- sheet:-Name of the sheet in Excel file.
- dtype:-Numpy data type.
The variable is treated to be a data frame.
Method 2: Using inbuilt menu Options of Rstudio
This approach is the easy approach to import the excel file in R compared with the previous one as this is the only approach to import an excel file in R where the user need not type any code in the console to import the excel file. Further, here user just needs to work on the environment window of the studio.
Environment window of the Rstudio:
Steps to import excel file using Dataset option from the environment window of Rstudio:
Step 1: Select the Import Dataset option in the environment window. Here the user needs to select the option to import the dataset from the environment window in Rstudio.
Step 2: Select the option of “From excel” under the import Dataset option. In this step, the user needs to select the option to “from excel” as the file is in the form of excel under the import dataset option to import the excel file.
Step 3: Select the browse option and select the excel file to be imported. Now, under this with the click to the browse option user will be given the choice to select the needed excel file to be imported in R.And then the user need to select the needed excel file to be imported in R.
Step 4: Select the import option and the excel file is successfully imported. Now, in this final step user need to select the import button and this will lead to successful importation of the selected excel file by the user in R.