I am a Stata user trying to learn R.
I have a couple of lengthy folder paths which, in my Stata code, I stored as local macros. I have multiple files in both those folders to use in my analysis.
I know, in R, I can change the working directory each time I want to refer to a file in one of the folders but it is definitely not a good way to do it. Even if I store the folder paths as strings in R, I can't figure out how to refer to those. For example, in Stata I would use `folder1'.
I am wondering if trying to re-write Stata code line by line in R is not the best way to learn R.
Can someone please help?
list.files(.)
. Look here. Also check?list.files
for all possible options. – Arunlocal folder1 "Z:/Project/Data/Raw"
. Suppose this folder Raw has a bunch of datasets I need to use, each time I want to load the dataset, I don't want to repeat "Z:/Project/Data/Raw". Instead, in Stata I stored it as a local and sayuse "
folder1'/file1.dta"` – user2012406