[R] pipe or system command

William Dunlap wdunlap at tibco.com
Thu Apr 4 18:19:58 CEST 2013


  dirname <- "c:/work/raw_data_files"
  dirlist <- dir(dirname, pattern="\\.txt$", full.names=TRUE)

The pattern matches all file names ending with ".txt", full.names=TRUE
means to include the directory name at the front of each file name.
Look at help("dir") for details.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of nalluri pratap
> Sent: Thursday, April 04, 2013 7:57 AM
> To: r-help at r-project.org
> Subject: [R] pipe or system command
> 
> Hi,
> 
> In SAS I have something like
> 
> %let dirname = c:\work\raw_data_files;
> filename DIRLIST pipe "dir /B &dirname\*.txt";
> 
> Can someone help me to convert this to R. I tried with system and pipe, but It actually
> creates a file on the disk which I don't like. I just need to have a reference to the file and
> use it in the analysis.
> 
> Thanks,
> Pratap
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list