R script doesn't seem to be closing a file properly, leaving it locked for editing by users. File and script are on a shared drive, script is run manually.
Note: I didn't write the script, and the person who did is no longer with the company, and that user is the one whose name is in the "locked for editing by" message. I'm trying to track down the issue for another manager.
I've not done much coding in R, in python the pd.read_excel function has built-in context, so I don't know how to force close a file programmatically in R. Any help would be appreciated.
Relevant code snippet:
Data <- read_excel("//foo/bar.xlsx",
sheet = "baz", col_types = c("skip",
"numeric", "text", "date", "text",
"numeric", "numeric", "numeric", "text", "text", "text",
"numeric", "text", "text", "date",
"text", "numeric", "date", "numeric",
"text", "text", "text", "text", "text",
"text","text"))