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?
Best Answer
Maybe you want
file.path()
?You can wrap
source
orread.XXX
or whatever else around that to do what you want.