[R] Error Running TinnR with R

Keith Jewell k.jewell at campden.co.uk
Fri Mar 12 16:55:29 CET 2010

Many people seem to have trouble defining '.trPaths' which is the set of 
file names which TinnR uses to communicate with R; the user must be able to 
create/write/read these files/folders.

In my Rprofile.site I have the single assingment:
.trPaths <- paste(paste(Sys.getenv("APPDATA"), "\\Tinn-R\\tmp\\", sep=""),
     c("", "search.txt", "objects.txt", "file.r", "selection.r", "block.r", 
"lines.r"), sep="")

At Rstartup this defines a user-specific vector based on the current value 
of the Windows environment variable APPDATA. In my particular case, on this 
particular machine, at the moment, it results in this vector:
> .trPaths
[1] "C:\\Documents and Settings\\jewell\\Application Data\\Tinn-R\\tmp\\"
[2] "C:\\Documents and Settings\\jewell\\Application 
[3] "C:\\Documents and Settings\\jewell\\Application 
[4] "C:\\Documents and Settings\\jewell\\Application 
[5] "C:\\Documents and Settings\\jewell\\Application 
[6] "C:\\Documents and Settings\\jewell\\Application 
[7] "C:\\Documents and Settings\\jewell\\Application 

I'm on Windows Server 2003 R2; I don't know if the same construction will 
work on Vista, but I think it probably would, I suggest trying it!

If that doesn't work, I have a few comments on your code which might be 
a) you have .trPath <- , not .trPaths <-

b) you are defining a list, not a vector, so .trPath[5] (for example) will 
return a single entry list, not a single character value. That doesn't work 
for me!
> as.list(.trPaths)[5]
[1] "C:\\Documents and Settings\\jewell\\Application 
> source(as.list(.trPaths)[5])
Error in source(as.list(.trPaths)[5]) : invalid connection

c) you are hard-coding the file paths, so if they change your TinnR will 

d) I don't think the elements need to be named, but it probably does no 

If you want to hard-code your file paths, and want the elements named, I 
suggest this might work:
.trPaths <- c('C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/',
 names(.trPaths) <- c("Tmp", "Search", "Objects", "File", "Selection", 

Hope that helps,

Keith J

"teck-corp" <d.tuerk at maastrichtuniversity.nl> wrote in message 
news:1268404061254-1590576.post at n4.nabble.com...
> Hi Stephen,
> Thanks a lot for your answer. Unfortunately this does not work for me
> neither.
> Could you maybe let me know what is written in you RprofileSite-file now?
> Best
> Dennis

More information about the R-help mailing list