[R] Working in subdirectories

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jul 8 20:55:26 CEST 2011


On 08/07/2011 2:47 PM, ssathnur wrote:
> I want to call in files from subdirectories without changing my working
> directory within my script. Is that possible? And if so what would be the
> simplest way to do that?
>
> for example, if I do setwd("C:/Users/Hello")
>
> but I have files in C:/Users/Hello/Data1 and C:/Users/Hello/Data2, can I
> still keep my working directory as C:/Users/Hello/ while calling in files in
> Data1 and Data2?

Yes, just refer to the files using relative paths, e.g. Data1/something 
and Data2/something.

Duncan Murdoch



More information about the R-help mailing list