[R] add counter to file name + dir.create

HBaize HBaize at buttecounty.net
Fri Jun 20 17:57:48 CEST 2008




## Create directory with unique name based on values of x and y
dir.create(paste(PathName, x,"_",y,sep=""))



Yasin Hajizadeh wrote:
> 
> Hi all
>    
>   I have 2 loops with 2 counters, say outer loop counter is  X and inner
> loop counter is Y. In outer loop a data file with known  number of columns
> and unknown number  of rows is generated in each script iteration. What
> inner loop should do is to read this file line by line and generate a
> directory for each row, then put the elements of that row in a text file
> insides the generated directory and then execute another script inside
> that directory ( system command )
>   I have 2 questions: I want the name of the directory to be unique and I
> am going to generate them by dir.create ( tell me if there is a better way
> ), so In the name which will be created, I want to add X, Y, so all the
> files generated at each inner loop and in next iterationsbe unique. How I
> can add X and Y to the file name? 
>   and the second question is general comments on the script structure
> itself.
>    
>   Thank you so much ( IN ADVANCE )
>    
>   Cheers
> 
>        
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/add-counter-to-file-name-%2B-dir.create-tp18010573p18032665.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list