What I am trying to do is go up three folders to the "New Model Setup" Folder, within that folder I am attempting to go down into the "Data Inputs" Folder and access my excel file.
The file of interest is in the Folder "C:/Users/Model Dev/New Model Setup/Data Inputs" I have set my working directory to...
getwd()
[1] "C:/Users/Model Dev/New Model Setup/Fiscal_Year/Quarter/Run"
I can see this files location using two different methods of list.files()
list.files('..\\..\\..\\Data Inputs\\')
[1] "Archive"
[2] "Data Inputs Master File.xlsx"
list.files('../../../Data Inputs/')
[1] "Archive"
[2] "Data Inputs Master File.xlsx"
However when I use the same structure in the read_excel function I get the Error path
does not exist.
crop_yield <- readxl::read_excel('..\\..\\..\\Data Inputs\\Data Inputs Master File.xlsx',
sheet = "CropYields")
Error: path
does not exist: ‘..\..\..\Data Inputs\Data Inputs Master File.xlsx’
crop_yield <- readxl::read_excel('../../../Data Inputs/Data Inputs Master File.xlsx',
sheet = "CropYields")
Error: path
does not exist: ‘../../../Data Inputs/Data Inputs Master File.xlsx’