Re: [R] differences between survival models between STATA and R

2012-07-09 Thread jthetzel
Be sure you reply or forward your message to me to the r-help listhost.  I
might not have time to review it tonight, while others might.

Jeremy

On Mon, Jul 9, 2012 at 2:38 PM, JPF [via R] <
ml-node+s789695n4635888...@n4.nabble.com> wrote:

> Please, find an example with a data set here.
>
> The data sets are prepared to be read with R (dataR) and STATA (dataSTATA)
> directly. The only difference is that STATA treats blanks as NAs.
>
> *in R, by using aftreg:*
>
> dataR<-read.table("clipboard",h=T)
> > su<-aftreg(Surv(sta,sto,S) ~
>  a+b+c+d+g+h+j+k+l+m+factor(pcont),dist="weibull",
> data=data.frame(dataR),id=ID)
> > summary(su)
>
> Call:
> aftreg(formula = Surv(sta, sto, S) ~ a + b + c + d + g + h +
> j + k + l + m + factor(pcont), data = data.frame(thern),
> dist = "weibull", id = ID)
>
> Covariate  W.mean  Coef Exp(Coef)  se(Coef)Wald p
> a  39.416 0.001 1.001 0.002 0.598
> b  55.879 0.002 1.002 0.001 0.002
> c  49.554-0.001 0.999 0.001 0.251
> d  51.266 0.000 1.000 0.000 0.758
> g  14.701-0.006 0.994 0.002 0.011
> h  32.358 0.005 1.005 0.001 0.000
> j  51.768-0.022 0.978 0.001 0.000
> k  53.832-0.004 0.996 0.001 0.000
> l  18.851 0.016 1.017 0.001 0.000
> m   0.809 0.907 2.478 0.132 0.000
> factor(pcont)
>10.007 0 1   (reference)
>20.272-0.051 0.950 0.158 0.745
>30.201 0.653 1.922 0.155 0.000
>40.253 0.181 1.198 0.156 0.246
>50.267 0.691 1.996 0.162 0.000
>
> log(scale)3.36929.038 0.225 0.000
> log(shape)1.925 6.858 0.055 0.000
>
> Events190
> Total time at risk  3129
> Max. log. likelihood  -298.47
> LR test statistic 681
> Degrees of freedom14
> Overall p-value   0
>
>
>
> *in STATA, by using streg:*
>
>  insheet using "dataSTATA.txt"
> (18 vars, 4862 obs)
>
> .
> . stset ntime, failure(s) id(id)
> id:  id
>  failure event:  s != 0 & s < .
> obs. time interval:  (ntime[_n-1], ntime]
>  exit on or before:  failure
> --
>
>  4862  total obs.
> 0  exclusions
> --
>
>  4862  obs. remaining, representing
>   351  subjects
>   283  failures in single failure-per-subject data
>  4862  total analysis time at risk, at risk from t = 0
>  earliest observed entry t = 0
>   last observed exit t =30
>
> .
> . gen f1 = 0
> . replace f1 = 1 if pcont==1
> (520 real changes made)
>
> .
> . gen f2 = 0
> . replace f2= 1 if pcont==2
> (1267 real changes made)
>
>
> . gen f3 = 0
> . replace f3= 1 if pcont==3
> (771 real changes made)
>
>
> . gen f4 = 0
> . replace f4= 1 if pcont==4
> (960 real changes made)
>
>
> . gen f5 = 0
> . replace f5= 1 if pcont==5
> (1344 real changes made)
>
>
> . streg  f1 f2 f3 f4 f5 a b c d g h j k l m, dist(weibull)  time nolog
>
>  failure _d:  s
>analysis time _t:  ntime
>  id:  id
> note: f5 dropped due to collinearity
>
> Weibull regression -- accelerated failure-time form
>
> No. of subjects =  228 Number of obs   =
>  3129
> No. of failures =  190
> Time at risk= 3129
>LR chi2(14) =
>  226.94
> Log likelihood  =   -47.541886 Prob > chi2 =
>  0.
>
> --
>
>   _t |  Coef.   Std. Err.  zP>|z| [95% Conf.
> Interval]
> -+
>
>   f1 |   .7194758   .2271213 3.17   0.002 .2743262
>  1.164625
>   f2 |   .4011278   .0604573 6.63   0.000 .2826336
> .519622
>   f3 |   .0142088   .0676573 0.21   0.834-.1183972
>  .1468148
>   f4 |   .2984225   .0814102 3.67   0.000 .1388614
>  .4579835
>a |   .0030444   .0024399 1.25   0.212-.0017377
>  .0078265
>b |  -.0008451   .0009987-0.85   0.397-.0028026
>  .0011124
>c |   .0015207   .0009827 1.55   0.122-.0004055
>  .0034468
>d |   .0005143   .0007139 0.72   0.471-.0008848
>  .0019135
>g |   .0024349   .0025024 0.97   0.331-.0024698
>  .0073395
> 

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread jthetzel
UCLA's Advanced Technical Services' Statistical Computing website often has
very good resources for comparing analyses between R, Stata, and SAS (
http://www.ats.ucla.edu/stat ). For accelerated failure time models, I
believe that it has some examples for Stata (
http://www.ats.ucla.edu/stat/stata/examples/asa/asastata8.htm ), but not for
R.  However, the Stata examples, to the best of my knowledge, use Hosmer and
Lemeshow's HMO HIV data from their 1998 Applied Survival Analysis text,
which happens to be available at
http://www.ats.ucla.edu/stat/R/examples/asa/hmohiv.csv .  Thus, you can try
reproducing UCLA's Stata AFT examples in R, and post the results here as a
reproducible example to illustrate what is confusing you.

For example:


Yields:


Which you can compare to the following from the UCLA website:


And then describe to r-help which discrepancies between the R and Stata
output are confusing you.

Regards,
Jeremy


JPF wrote
> 
> Dear Community,
> 
> I have been using two types of survival programs to analyse a data set.
> 
> The first one is an R function called aftreg. The second one an STATA
> function called streg.
> 
> Both of them include the same analyisis with a weibull distribution. Yet,
> results are very different. 
> 
> Shouldn't the results be the same?
> 
> Kind regards,
> J
> 


-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/differences-between-survival-models-between-STATA-and-R-tp4635670p4635863.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing package QRMlib

2012-02-29 Thread jthetzel
QRMlib built without errors on my WIndows machine.  Here's the resulting zip
binary:
http://commondatastorage.googleapis.com/jthetzel-public/QRMlib_1.4.5.1.zip

Will that install on your machine?

Jeremy



DT54321 wrote
> 
> I wouldn't see myself as an experienced R user soI would appreciate if
> anyone is able to give me a clear set of instructions on how to install
> and load QRMlib. The steps I've followed are:
> 
> 1: Download 'QRMlib_1.4.5.1.tar.gz' from
> http://cran.r-project.org/src/contrib/Archive/QRMlib/ to my local folder.
> 
> 2. QRMlib depends on methods, fCalendar, fEcofin, mvtnorm, chron,its,Hmisc
> so I install all of these. I install teh following from within RStuidos
> using the  Packages tab:
> 
> a) mvtnorm
> b) chron
> c) its
> d) Hmisc 
> e) methods
> 
> And download the tar.gz files from the archive for:
> 
> A) fCalendar
> b) fEcofin
> 
> In R, I also use the install.packages with type = "source" and repos =
> NULL to install the packages listed in A) and B)
> 
> 3. In R, then enter
> 
> iinstall.packages(file_name, type ="source", repos = NULL)
> 
> where file_name is the directory for QRMlib_1.4.5.1.tar.gz.
> 
> It outputs the following error:
> 
> Installing package(s) into ‘C:/Program Files/R/R-2.14.1/library’
> (as ‘lib’ is unspecified)
> * installing *source* package 'QRMlib' ...
> ** Creating default NAMESPACE file
> ** libs
> ERROR: compilation failed for package 'QRMlib'
> * removing 'C:/Program Files/R/R-2.14.1/library/QRMlib'
> * restoring previous 'C:/Program Files/R/R-2.14.1/library/QRMlib'
> Warning in install.packages :
>   running command 'C:/PROGRA~1/R/R-214~1.1/bin/i386/R CMD INSTALL -l
> "C:/Program Files/R/R-2.14.1/library"  
> "my_local_folder/QRMlib_1.4.5.1.tar.gz"' had status 1
> Warning in install.packages :
>   installation of package ‘Pmy_local_folder/QRMlib_1.4.5.1.tar.gz’ had
> non-zero exit status
> 
> Please help!
> 

-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Installing-package-QRMlib-tp4425269p4431832.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing package QRMlib

2012-02-28 Thread jthetzel
I installed fEcofin, fUtilities, fCalenday, and fSeries from the CRAN
archives and was able to install and load QRMlib.

Which errors does "R CMD check QRMlib_1.4.5.1.tar.gz" show?



DT54321 wrote
> 
> According to the QRMlib package pdf, 
> 
> http://www.mirrorservice.org/sites/lib.stat.cmu.edu/R/CRAN/doc/packages/QRMlib.pdf
> 
> the package depennds on methods, fCalendar, fEcofin, mvtnorm,
> chron,its,Hmisc. I have installed all of these (some were retrieved from
> archive and some were retrieved from CRAN) and still getting errors.
> 
> I'm just wondering whether anyone has successfully loaded QRMlib??
> 

-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Installing-package-QRMlib-tp4425269p4428842.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing package QRMlib

2012-02-28 Thread jthetzel
Next, you should check C:/Program
Files/R/R-2.14.1/bin/QRMlib.Rcheck/00install.out for details on the error.


DT54321 wrote
> 
> In command prompt, I direct to the following directory:
> 
> C:\Program Files\R\R-2.14.1\bin
> 
> Now I enter:
> 
> R CMD check "my_local_folder\QRMlib_1.4.5.1.tar.gz"
> 
> The following appears:
> 
> * using log directory 'C:/Program Files/R/R-2.14.1/bin/QRMlib.Rcheck'
> * using R version 2.14.1 (2011-12-22)
> * using platform: i386-pc-mingw32 (32-bit)
> * using session charset: ISO8859-1
> * checking for file 'QRMlib/DESCRIPTION' ... OK
> * this is package 'QRMlib' version '1.4.5.1'
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... NOTE
> As from R 2.14.0 all packages need a namespace.
> One will be generated on installation, but it is better to handcraft a
> NAMESPACE file: R CMD build will produce a suitable starting point.
> * checking for .dll and .exe files ... OK
> * checking whether package 'QRMlib' can be installed ... ERROR
> Installation failed.
> See 'C:/Program Files/R/R-2.14.1/bin/QRMlib.Rcheck/00install.out' for
> details.
> 

-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Installing-package-QRMlib-tp4425269p4429041.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing package QRMlib

2012-02-28 Thread jthetzel
I think you'll need to install fEcofin from CRAN, and then the following
.tar.gz files from the CRAN archives:
fUtilities
fCalenday
fSeries

And then try installing the QRMlib .tar.gz.

If you're still having problems, try: 
"C:/Program Files/R/R-2.14.0/bin/x64/R" CMD check "QRMlib_1.4.5.1.tar.gz"
(or whatever is equivalent for your R installation) from the Windows command
prompt .  That will output more useful information on errors and warnings.


Jeremy


Jeremy Hetzel
Boston University



Pfaff, Bernhard Dr. wrote
> 
> As stated, you need to install the *deprecated* dependencies of QRMlib as
> shown in its DESCRIPTION as well as the reverse dependent *deprecated*
> packages. These can still be fetched from R-Forge (Rmetrics project). The
> package 'timeSeries' will become a dependency of the to be re-released
> QRMlib package on CRAN.  
> 
> -Ursprüngliche Nachricht-
> Von: r-help-bounces@ [mailto:r-help-bounces@] Im Auftrag von DT54321
> Gesendet: Dienstag, 28. Februar 2012 11:10
> An: r-help@
> Betreff: Re: [R] Installing package QRMlib
> 
> Thanks for the reply guys. Well, I've tried the following command after
> installing the package dependancies including timeSeries:
> 
> install.packages(file_name, type = "source", repos = NULL)
>  
> Ans still no luck...I get the following error message:
> 
> Installing package(s) into ‘C:/Program Files/R/R-2.14.1/library’
> (as ‘lib’ is unspecified)
> * installing *source* package 'QRMlib' ...
> ** Creating default NAMESPACE file
> ** libs
> ERROR: compilation failed for package 'QRMlib'
> * removing 'C:/Program Files/R/R-2.14.1/library/QRMlib'
> * restoring previous 'C:/Program Files/R/R-2.14.1/library/QRMlib'
> Warning in install.packages :
>   running command 'C:/PROGRA~1/R/R-214~1.1/bin/i386/R CMD INSTALL -l
> "C:/Program Files/R/R-2.14.1/library"   
> "my_local_folder/QRMlib_1.4.5.1.tar.gz"' had status 1 Warning in
> install.packages :
>   installation of package ‘my_local_folder/QRMlib_1.4.5.1.tar.gz’ had
> non-zero exit status
> 
> Any ideas??
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Installing-package-QRMlib-tp4425269p4427627.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@ mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> *
> Confidentiality Note: The information contained in this message,
> and any attachments, may contain confidential and/or privileged
> material. It is intended solely for the person(s) or entity to
> which it is addressed. Any review, retransmission, dissemination,
> or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient(s) is
> prohibited. If you received this in error, please contact the
> sender and delete the material from any computer.
> *
> __
> R-help@ mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Installing-package-QRMlib-tp4425269p4428517.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] superscript

2011-02-01 Thread jthetzel

Correction, I forgot the caret:

legend(210, 110, bquote(r^2 ==
.(format(summary(regression)$adj.r.squared,digits=3 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/superscript-tp3252881p3252924.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] superscript

2011-02-01 Thread jthetzel

Would the following work?

legend(210, 110, bquote(r2 ==
.(format(summary(regression)$adj.r.squared,digits=3

See ?plotmath and ?bquote

Jeremy

Jeremy Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/superscript-tp3252881p3252921.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to change size of xlab inplot?

2011-02-01 Thread jthetzel

Rainer,

Take a look at this thread:

http://www.mail-archive.com/r-help@r-project.org/msg64936.html


Jeremy

Jeremy Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-change-size-of-xlab-inplot-tp3250762p3250960.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-/Text-editor for Windows?

2011-01-30 Thread jthetzel

Sascha,

I second Tobias' recommendation of Eclipse with StatET.  Like Emacs, Eclipse
is platform independent and easily extensible to essentially any other
language, as well as revision control like git and svn.  I used to use
Tinn-R, but haven't been back seen switching to Eclipse.

Jeremy

Jeremy Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-Text-editor-for-Windows-tp3245162p3247173.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reading sas7bdat files into R

2010-12-30 Thread jthetzel

Sashi,

There is also a command line utility for sas7bdat files called dsread
(http://www.oview.co.uk/dsread/).  I've never used it, but it looks good. 
Built for Windows, but should run under Linux with Wine.

Jeremy

Jeremy T. Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Reading-sas7bdat-files-into-R-tp3165608p3168670.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Importing Sas files to R

2010-12-30 Thread jthetzel

Reka,

If you do not have SAS available, there is also a free program provided by
SAS called the SAS System Viewer, which will export sas7bdata files to csv. 
N.b. that I've heard it can be buggy if any character variables contain
unmatched quotes.  I've also read in a previous post
(http://r.789695.n4.nabble.com/Reading-sas7bdat-files-directly-td1469515.html)
of a program written by Chris Long called dsread
(http://www.oview.co.uk/dsread), which will do the trick.  I haven't used it
yet, but it sounds a lot better than fumbling through the SAS System Viewer.

Jeremy

Jeremy T. Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Importing-Sas-files-to-R-tp3165690p3168660.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Extract subset of rows

2010-12-17 Thread jthetzel

Hi John,

I'd recommend looking into ?merge.

Jeremy

Jeremy T. Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Extract-subset-of-rows-tp3092669p3092700.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Running R on a server

2010-10-11 Thread jthetzel

Sachin,

I apologize if I'm over-simplifying your question.  I mostly run R on an
Ubuntu server via a Windows laptop.  I log in to the remote server via SSH
(via PuTTY on Windows), and then open an interactive R session through the
usual ways (typing 'R' at the Linux command line).  When creating figures,
I'll usually just output the figures to pdfs, via pdf().  However, if I need
a more interactive experience with the figures, I'll ask PuTTY to initiate
'X11 forwarding', which, on Windows, also requires an X server, such as
Xming.  This causes plots to appear in new windows just like you were
running R on your local machine.

If you are interested in running non-interactive batch R scripts, reference
the following:
http://stat.ethz.ch/R-manual/R-devel/library/utils/html/BATCH.html .

Another note on running R over SSH: if you lose your SSH connection, the R
process will stop.  I get around this by using the 'screen' command in Linux
(http://en.wikipedia.org/wiki/GNU_Screen).  See man screen for details. 
While 'screen' does many things, relevant to this thread it creates new
remote terminals that persist after SSH disconnects.  After SSHing into my
server, I type 'screen' and [return], then 'R'.  R starts up and I start the
analysis.  I can manually 'detach' the screen by hitting the 'control' and
'a' keys together, and then hitting the 'd' key.  The R process (and any
other processes started in that screen session) will continue to run.  One
can start many screens.  Typing 'screen -ls' shows the currently running
screens.  If only one screen is running, typing 'screen -r' will attach that
screen, and one can continue on one's analysis in R.  If multiple screen
sessions are open, one will need to specify the screen name after the
'screen -r' command.  Sometimes after an abrupt disconnect, the screen will
remain attached, even though the SSH connection is lost.  To get back to the
screen session, one must first 'detach' and then 're-attach' the screen by
typing 'screen -dr'.

Let me know if you have more specific questions.

Cheers,
Jeremy

Jeremy Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Running-R-on-a-server-tp2967748p2991084.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about assigning values in a matrix, conditional on column first row; how to do the loop.

2010-10-05 Thread jthetzel

Paula,

Just for fun, another way:

## Create 10 by 10 example matrix
set.seed(100)
a <- matrix(sample(c(0,1,2),100, replace=T), nrow=10, ncol=10)
a[1,] <- sample(c(0.25,0.5,0.75),ncol(a), replace=T)

## Use apply to substitiute matrix values by row
b <- apply(a, 1, function(x)
{
  row <- x
  row[row==0 | row==1] <- -999
  row[which(row==2)] <- a[1,which(x==2)]
  return(row)
})

## Transpose result matrix
b <- t(b)



Cheers,
Jeremy

Jeremy Hetzel
Boston University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Question-about-assigning-values-in-a-matrix-conditional-on-column-first-row-how-to-do-the-loop-tp2956355p2964227.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tinn R

2010-10-03 Thread jthetzel

Raphael,

I too had problems setting up Tinn-R 2.3.5.2 with R 2.11.1-x64 in 64-bit
Windows 7.  The following I had previously written to a colleague to show
how I resolved the problems.  I'm not sure if any of this will be of help to
you, but Step 3 fixed an issue I was having with .trPaths.  

Cheers,
Jeremy

Jeremy Hetzel
Boston University


1) Change permissions for the C:\Users\$USER\AppData\Roaming\Tinn-R
directory.
Windows 7 makes this directory read-only by default, but Tinn-R
expects to be able to write to it, causing errors.  For me, I went to
C:\Users\jthetzel\AppData\Roaming, right-clicked the Tinn-R directory,
and un-checked the 'Read-only' attribute.

2) Run Tinn-R as administrator
I found that if I went back to the ...Roaming\Tinn-R directory later,
Windows had reset the attribute to 'Read-only'.  So, far good measure,
I also changed the Tinn-R.exe file under C:\Program Files (x86)\Tinn-R
\bin\ to run as administrator. Browse to the directory, right-click
the Tinn-R.exe file, select properties, click the Compatibility tab,
and check the Run as Administrator box.  Having accomplished step 2),
step 1) is probably unnecessary.  But I include it here just because
it's what I did, and Tinn-R magically works again.

3) Change Options>Application>R>Rgui>Type to 'Partial' from 'Whole' in
Tinn-R, via the menu bar
Steps 1) and 2) addressed the problem where Tinn-R would complain
about '.trPaths' when sending code to R.  However, I had the
additional problem of Tinn-R refusing to even attempt to send code to
R (the 'R send file' and 'R send selection' icons were dimmed out).
Changing  Options>Application>R>Rgui>Type to 'Partial' from 'Whole' in
Tinn-R, via the menu bar solved this problem.  I don't know why.



The following is for anyone having problems with using Tinn-R with the
development R version 2.12.0x64.  In the Windows development version I
downloaded, both the 32 and 64 bit R libraries were included.
Subsequently, the folder structure has changed, which Tinn-R does not
recognize by default.

4) Change Options>Application>R>Rterm.exe search path to wherever your
Rterm.exe is located.
For me, it was C:\Program Files\R\R-2.12.0dev\bin\x64\Rterm.exe

5) Change Options>Application>R>Rgui.exe search path to wherever your
Rgui.exe is located.
For me, it was C:\Program Files\R\R-2.12.0dev\bin\x64\Rgui.exe

6) Set 'Options>Application>R> Use latest installed version (always)'
to 'No' from 'Yes'
If this is not changed, Tinn-R will try to reconfigure itself every
time it is re-opened to use the most recent installed R.  Since it is
not familiar with the change in folder structure in the development
version, it will fail.

7) Copy ...R-2.12.0dev\etc\Rprofile.site file to  ...R-2.12.0dev\bin
\etc\Rprofile.site
Tinn-R expects the Rprofile.site file to be in the ..\etc folder,
relative to wherever Rgui.exe or Rterm.exe are. However, in the new
folder structure, the etc folder is actually located at ..\..\etc,
relative to Rgui.exe and Rterm.exe. I could not find anywhere to
manually reconfigure the search path for the Rprofile.site file, so I
just created a new etc folder where Tinn-R is expecting it.  In my
case, I created C:\Program Files\R\R-2.12.0dev\bin\etc and copied the
Rprofile.site file to it.  For comparison, the contents of my
Rprofile.site file appears below.  For some reason, every time I re-
start Tinn-R, it appends another copy of the Tinn-R configuration
lines to the Rprofile.site file.  However, this behavior has not
caused any problems thus far.




#-- Example of my Rprofile.site file--#

# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
 options(help_type="html")

# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-
library")

# set a CRAN mirror
# local({r <- getOption("repos")
#   r["CRAN"] <- "http://my.local.cran";
#   options(repos=r)})


##===
## Tinn-R: necessary packages and functions
## Tinn-R: >= 2.2.0.2 with TinnR package >= 1.0.3
##===
## Set the URL of the preferred repository, below some examples:
options(repos='http://software.rc.fas.harvard.edu/mirrors/R/') # USA
#options(repos='http://cran.ma.imperial.ac.uk/') # UK
#options(repos='http://brieger.esalq.usp.br/CRAN/') # Brazil

library(utils)

## Check necessary packages
necessary <- c('TinnR', 'svSocket')
installed <- necessary %in% installed.packages()[, 'P