'Accessing an Excel file imported to R

I have just started using R and imported my first Excel file named tblMainXmasFund. When I try running data(tblMainXmasFund) I get the following:

Warning message: In data(tblMainXmasFund) : data set ‘tblMainXmasFund’ not found

The readxl package has been installed. When I try running library(readxl) I get: Warning message: package ‘readxl’ was built under R version 4.1.3 (My version of R is 4.1.2)

I'm guessing I have missed a necessary step but have no clue what it is. Any suggestions would be greatly appreciated.



Solution 1:[1]

You can use this code:

library(readxl)
tblMainXmasFund <- read_excel("Path_file/tblMainXmasFund.xls")

In Path_file write the address of your Excel file. Remember to use / to separate path and file name.

In this way, tblMainXmasFund is a "container" to your Excel file, if later in your code you have to do something with this data you can use only tblMainXmasFund to call it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Inuraghe