[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 
Data\\Tinn-R\\tmp\\search.txt"
[3] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\objects.txt"
[4] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\file.r"
[5] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\selection.r"
[6] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\block.r"
[7] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\lines.r"

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 
helpful:
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]]
[1] "C:\\Documents and Settings\\jewell\\Application 
Data\\Tinn-R\\tmp\\selection.r"
> 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 
break.

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

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/',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/search.txt',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/objects.txt',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/file.r',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/selection.r',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/block.r',
          'C:/Users/dennis/AppData/Roaming/Tinn-R/tmp/lines.r'
            )
 names(.trPaths) <- c("Tmp", "Search", "Objects", "File", "Selection", 
"Block","Lines")

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