Re: [R] Replacing backslashes with slashes

From: Duncan Golicher <>
Date: Fri 06 Jan 2006 - 05:11:27 EST

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(gsub("\\\\","/",readLines("clipboard")))   options(warn=0)

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


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


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 mailing list PLEASE do read the posting guide! Received on Fri Jan 06 05:17:11 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:51 EST