It  is often convenient to quickly set the working directory to a path 
copied onto the windows clipboard. A simple trick I have been using for 
a while is along the lines given in the previous posts.

setwd.clip<-function()
{
  options(warn=-1)
  setwd(gsub("\\\\","/",readLines("clipboard")))
  options(warn=0)
  getwd()
}


I load this at the start of every session and then write setwd.clip() 
whenever I have a path I want to change to on the clipboard. You can of 
course write

setwd(gsub("\\\\","/",readLines("clipboard")))

everytime you need it. Obviously it takes longer and there is the minor 
detail that the path read from the clipboard is incomplete (no EOL 
marker) which leads to an unnecessary warning.


Dr Duncan Golicher
Ecologia y Sistematica Terrestre
Conservación de la Biodiversidad
El Colegio de la Frontera Sur
San Cristobal de Las Casas, 
Chiapas, Mexico

Email: [EMAIL PROTECTED] 

Tel: 967 674 9000 ext 1310
Fax: 967 678 2322
Celular: 044 9671041021

United Kingdom Skypein; 020 7870 6251
Skype name: duncangolicher 
Download Skype from http://www.skype.com

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to