Hmm I will try something like that if (file.exists('threshold')==FALSE) dir.create(paste('./',abs(threshold)))
save(var,file=paste('./',abs(threshold),'/',DataSource[[4]],sep="") I just need a bit of confirmation If I am doing soemthing terribly wrong that might harm my filesystem. I also did accidentaly var<- -13 dir.create(paste('./',var)) which created a folder called -13 which I do not know how to remove it rmdir -13 rmdir: invalid option -- '1' Try `rmdir --help' for more information. B.R Alex ________________________________ From: Joshua Wiley <jwiley.ps...@gmail.com> Cc: "R-help@r-project.org" <R-help@r-project.org> Sent: Tuesday, November 8, 2011 2:43 PM Subject: Re: [R] save at relative directory Hi Alex, Look at some of these functions: apropos("dir") apropos("exists") Cheers, Josh > Dear all, > I have a variable called thres and before I run a script I set it to a value > like > thres<- -10 > at the end of the execution I am issuing a save(variablename,file='Results') > which will end up with a file saved at the current directory with the name > Results > > I would like though to use thres value and do the followingg > save at the directory called 10 so to get ./10/Results, (yes I want this in a > relative order) > > My question is how I can also check if the directory exists R to create it? > > I would like to thank you in advance for your help > > B.R > Alex > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > > -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ [[alternative HTML version deleted]]
______________________________________________ R-help@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.