Please forgive if the code looks bad or if this is a dumb question, I'm brand new to R. Can someone help me on how to choose where I am saving the excel file to locally. That's what I'm attempting to do with the "c:\Users\Desktop\decstats.xlsx" but that is for some reason being included in the entire name of the document and where it gets saved is a nightmare. Can only go find it about 50% of the time
writexl::write_xlsx(decstats, "c:\\Users\\Desktop\\decstats.xlsx")
different systems have different conventions around path delimiters, its generally advisable to have R construct a path for you by using file.path()
perhaps
writexl::write_xlsx(decstats,
file.path("C:","Users","Tommy Mulflur","Desktop","decstats.xlsx"))
also if theres any doubt about the directory , you can check if R undserstands it exists with something like
dir.exists(file.path("c:","Users"))
dir.exists(file.path("c:","Users","Tommy Mulflur"))
maybe adding it up iteratively will show you if you have a typo or somesuch along the way
Ok got it thank you so much! I tried parsing it up step by step and it returns false on either of the two below. I am now looking into creating/setting a directory. Always another challenge to go tackle!
dir.exists(file.path("c:"))
[1] FALSE
dir.exists(file.path("c:", "Users"))
[1] FALSE
Any suggestions on this one?
Does seem strange. If you ask r to give you a temporary directory, what path does it return?
tempdir()
Also, what is your working directory?
getwd()
?
I figured it out! Thank you so much. I can send the correct code if your curious.
I'm sure I'll have more silly questions soon. So much fun, but so much to learn!