[R-sig-teaching] workspace management

Gabor Grothendieck ggrothendieck at gmail.com
Mon Dec 6 12:38:16 CET 2010


On Mon, Dec 6, 2010 at 6:27 AM, david monterde <dmonterde at me.com> wrote:
> I use the select.list when I have welldefined the paths and the fix function when not
> I start idetifyind the unit, and then the rest of the path:
>
>   unit   <- select.list(paste(letters,":/",sep=""))
>   paths <- c("Projects/Data/", "MyPenDrive/Projects/Data")
>   path  <- select.list(paths)
>   path  <- paste(unit,path,sep="")
>
> So I can work with the same program in any computer using my pendrive, or in my computer using my own path.
>
> If there is not a fixed path:
>
>   path <- "c:/new path/"
>   fix(path)
>
> You can use the select-list function to choose between different platforms, (Linux, Mac, Windows):
>
>   OS   <- select.list("Lunix,"Mac","Windows")
>   if (OS=="Linux") then { # use the select.list function with paths in Linux format (//users//) }
>   if (OS=="Windows") then { # use the select.list function with paths in Linux format (c:/) }
>

You can detect windows vs. unix using .Platform$OS eliminating a
question to the user.  See ?.Platform

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com




More information about the R-sig-teaching mailing list