Bryan Schmidt
Bryan Schmidt

Reputation: 13

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.

Upvotes: 0

Views: 322

Answers (1)

Inuraghe
Inuraghe

Reputation: 596

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.

Upvotes: 2

Related Questions