[R] Error : package 'xxx' was built before R 3.0.0: please re-install it
Hello, Here are the steps to the error: 1. Uninstall R version 2.x.y. 2. Install the latest version (3.2.3) of R. 3. Copy all my libraries that were not in the new version into the new R library. 4. Run "> update.packages(checkBuilt=TRUE, ask=FALSE)" under R-Studio. Many packages were updated but for some I received: "Error : package 'xxx' was built before R 3.0.0: please re-install it" error. Here is an example: * installing *source* package 'agricolae' ... * package 'agricolae' successfully unpacked and MD5 sums checked ** R ** data ** inst ** preparing package for lazy loading Error : package 'spdep' was built before R 3.0.0: please re-install it ERROR: lazy loading failed for package 'agricolae' * removing 'C:/Program Files/R/R-3.2.3/library/agricolae' Warning in install.packages : running command '"C:/PROGRA~1/R/R-32~1.3/bin/i386/R" CMD INSTALL -l "C:\Program Files\R\R-3.2.3\library" C:\Users\user\AppData\Local\Temp\RtmpG8mSYd/downloaded_packages/agricolae_1. 2-3.tar.gz' had status 1 Warning in install.packages : installation of package 'agricolae' had non-zero exit status The downloaded source packages are in 'C:\Users\user\AppData\Local\Temp\RtmpG8mSYd\downloaded_packages' If I try to install "spdep" package first I get the following error: > install.packages("spdep") also installing the dependency 'sp' Packages which are only available in source form, and may need compilation of C/C++/Fortran: 'sp' 'spdep' These will not be installed How can I fix such errors? I can Thank you. Cem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] FW: Library update from version
Hello, I recently installed version 3.0.1 of R on to a computer. I have a working installation for a Statconn application using R version 2.15.0 on another computer. I have many libraries under this old installation. Can I just copy them into the new library from the old, or do I install each one of them under the new R? Also how can I get a list of differences in two libraries so that I can use this list to update the new one? Thank you. Cem __ 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] Writing R-scripts
Hello Jim, Thank you. This will really help me to get the result I need. But I am having an error message when I run the code although "testtype" is set to 2 in the calling function to run the Dunnet test. What am I doing wrong? > pt<-parametric.tests(testtype=2, resp, groups, vehicle="Control", alpha=0.05) Error in clean.args(resp, group, vehicle, alpha, lmat, testtype) : unused argument(s) (testtype) library(plotrix) parametric.tests<-function(testtype, resp, group, vehicle, alpha, lmat){ result<-do.call(deparse(substitute(testtype)), clean.args(resp, group, vehicle, alpha, lmat, testtype)) return(result) } if (testtype==1){ ### ## resp: response variable, must be numeric and vector ## group: group id for resp, numeric or character ## alpha: CL 0.05 or 0.01 ## Bonferroni bonferroni.test <- function(resp, group, alpha) { . result <- data.frame(label=label, estimate=estimate, alpha=alpha, p.value=pval, significance=sig) return(result) } } else if (testtype==2){ ### ## resp: response variable, must be numeric and vector ## group: group id for resp, numeric or character ## alpha: CL 0.05 or 0.01 ## vehicle: label for the reference group (for example, vehicle = "Control" if the lable for the ## reference group is 'Control') ## Dunnett dunnett.test <- function(resp, group, alpha, vehicle) { result <- data.frame(label=label, estimate=estimate, alpha=alpha, lower=lower, upper=upper, p.value=pval, significance=sig) return(result) } } Cem -Original Message- From: Jim Lemon [mailto:j...@bitwrit.com.au] Sent: Tuesday, February 14, 2012 3:32 AM To: Cem Girit Cc: r-help@r-project.org Subject: Re: [R] Writing R-scripts On 02/14/2012 08:59 AM, Cem Girit wrote: > Hello, > > This is my first attempt to write a script in R. The program below is > intended to do some parametric tests on group data. There are > subroutines for each type of test. The call to the "parametric.tests", > routine sets the argument "testtype" for the test to be used. How can > I transfer the calculated values (in "result" below) in each routine > to the calling parametric.tests routine? > Hi Cem, You may find it easier to use the do.call method and the clean.args function: library(plotrix) parametric.tests<-function(testfun,arglist) { result<-do.call(deparse(substitute(testfun)), clean.args(arglist,testfun)) return(result) } parametric.tests(mean,list(x=1:5,na.rm=TRUE,foo="?")) If the function called ("testfun") is available, and the argument "arglist" contains sufficient arguments for it to run, it will return the value of the function. The reason for using "clean.args" is in case you are passing a fixed list of arguments, all of which may not be appropriate for any of the functions that you want to pass as "testfun". Jim __ 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.
[R] Writing R-scripts
Hello, This is my first attempt to write a script in R. The program below is intended to do some parametric tests on group data. There are subroutines for each type of test. The call to the "parametric.tests", routine sets the argument "testtype" for the test to be used. How can I transfer the calculated values (in "result" below) in each routine to the calling parametric.tests routine? Cem ## testtype : 1: Duncan ## 2: Dunnett ## resp: response variable, must be numeric and vector ## group: group id for resp, numeric or character ## alpha: CL 0.05 or 0.01 ## vehicle: Control group name for Dunnett parametric.tests<-function(testtype, resp, group, vehicle, alpha) { if (testtype==1){ ## resp: response variable, must be numeric and vector ## group: group id for resp, numeric or character ## alpha: CL 0.05 or 0.01 duncan.test <- function (resp, group, alpha) { . result <- data.frame(label=label, estimate=Estimate, alpha=alpha, lower=Lower, upper=Upper, p.value=pval, significance=sig) return(result) } } else if (testtype==2){ dunnett.test <- function(resp, group, vehicle, alpha) { . result <- data.frame(label=label, estimate=Estimate, alpha=alpha, lower=Lower, upper=Upper, p.value=pval, significance=sig) return(result) } } } Cem __ 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] Upgrade R?
Hello John, Thank you. It is useful advice. I found the method which eliminates copying the library after new installation given at by Tal at http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-t he-r-code-to-do-it-on-windows/ very effective. But my problem and some others was not being able to remove the old installation buy running unins000.exe. We experience an error "Internal error: Cannot find utCompiledCode record for this version of uninstaller". So we had to remove the program and clean the registry manually. This might be due to 1) We install R and statconn using "RAndFriendsSetup2140V3.2-1-1" package from http://rcom.univie.ac.at/ 2) Tal's scripts that create the external library and copy the contents after the new installation might do something causing this error. Duncan tried the installation on his Window 7 x64 system and did not have any problems removing the old installation. Sincerely, Cem -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of John C Frain Sent: Tuesday, November 15, 2011 4:22 PM To: Rainer M Krug Cc: r-help@r-project.org; Kevin Burton Subject: Re: [R] Upgrade R? Generally I have several versions of R installed on any PC running Windows 7 and have never had any problem choosing which version of R was to be the default one. In the past the updated version did not always register as the default but there was and is a utility RSetReg.exe in the bin directory of each distribution which appeared to solve the problem. RStudio, Vincent's Goulet's emacs package for Windows and several other windows GUIs have facilities for setting the sefault R to use. When installing an upgrade I do the following 1 Download and install the new version 2 Rename the library directory in the new distribution to librarytemp 3 Copy the library from the old version to the new distribution. 4 Copy/Move the contents of librarytemp to this library directory (I want to keep the updated base packages) 5 When I am satisfied that the old version is no longer required I uninstall it either from the start menu or the unins000.exe utility in the r distribution. When this is run any remaing files in the R distribution may be deleted. I have never had any r related problems with this procedure. (I have had problems with an anti-virus program but that is another matter. Best Regards John Best Regards John On 15 November 2011 08:58, Rainer M Krug wrote: > On Mon, Nov 7, 2011 at 9:23 PM, Kevin Burton wrote: > >> I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the >> libraries from the 'library' directory in my existing installation >> (2.13.1) to the installed R 2.14. Now I want to uninstall the old >> installation (R >> 2.13.1) and I get the error: >> >> >> >> Internal Error: Cannot find utCompiledCode record for this version of >> the uninstaller. >> >> >> > What I would try: reinstall the old version and then uninstall it - I > remember that similar approaches worked while I was still using > windows (Windows 2000) ... luckily long time ago. > > Cheers, > > Rainer > > >> >> Any ideas? >> >> >> >> Kevin >> >> >> [[alternative HTML version deleted]] >> >> __ >> 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. >> > > > > -- > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation > Biology, UCT), Dipl. Phys. (Germany) > > Centre of Excellence for Invasion Biology Stellenbosch University > South Africa > > Tel : +33 - (0)9 53 10 27 44 > Cell: +33 - (0)6 85 62 59 98 > Fax (F): +33 - (0)9 58 10 27 44 > > Fax (D): +49 - (0)3 21 21 25 22 44 > > email: rai...@krugs.de > > Skype: RMkrug > > [[alternative HTML version deleted]] > > __ > 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. > -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@gmail.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. __ 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, rep
Re: [R] Upgrade R?
od, then first run the following two lines on your old R installation (before running the above code in the new R intallation): source("http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-o n-windows.r.txt") Old.R.RunMe() Ref: http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-t he-r-code-to-do-it-on-windows/ http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/ This update leaves two library directories one in the "C:\Program Files\R\library" directory and the other in the "C:\Program Files\R\R-2.14.0\library" directory. Deleting the second makes R console confused since it cannot find even the basic library. But undeleting it, is extra ~0.5GB space. Uninstalling the old version of R: After all the packages are updated and the depended ones such as rcom were registered, the old version can be uninstalled through "Programs and Features" option of Windows. Problems with installing the new version and uninstalling the old version: There are many problems reported. Here are a few: 1. Windows 7 issues: Windows security, UAC, installation directories etc. See: Ref: http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/ 2. Uninstalling error "Internal error: Cannot find utCompiledCode record for this version of uninstaller". You can delete the old installation directory and remove the registry entries manually or use a program such as CCleaner to remove the registry entries. Cem -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gene Leynes Sent: Monday, November 14, 2011 4:43 PM To: r-help@r-project.org Cc: Kevin Burton Subject: Re: [R] Upgrade R? I have had similar problems. I have several installations of R and now I have no control over which one opens when I try opening a RData file. The RGUI is registered more than once, but they all have the exact same appearance in the "choose programs" menu. It's become particularly annoying now that new versions of R seem to be published with ever increasing frequency. On Mon, Nov 14, 2011 at 10:11 AM, Kevin Burton wrote: > I am also using statConn so I will let you know if I hear anything new. > > -Original Message- > From: Cem Girit [mailto:gi...@comcast.net] > Sent: Monday, November 14, 2011 8:52 AM > To: 'Kevin Burton' > Cc: r-help@r-project.org > Subject: RE: [R] Upgrade R? > > Hello Kevin, > >Thank you. I will delete the folder and run an application > called CCleaner (free). That will remove all the broken registry entries. > >There should be a problem free update path for R installation. > As you rightfully mentioned the R- manual is not clear about package > update issues. I received many helpful suggestions on the update path > but some of the them were contradictory in the order of steps to be > taken. I am also using statConn (DCOM) interface for programming. So > my problems are multifold. I will compile the answers I received on > the R version update issue and publish them so that that the experts > could put them into more effective use. > >Sincerely, > > Cem > > > -Original Message- > From: Kevin Burton [mailto:rkevinbur...@charter.net] > Sent: Sunday, November 13, 2011 4:11 PM > To: 'Cem Girit' > Subject: RE: [R] Upgrade R? > > I don't know if it was correct but I just removed the directory and > then searched and removed all instances in the registry that referred > to 2.13.1 (in my case searching for this seemed to only return > references to 'R'). I have since been given some links that address > specific registry entries but I haven't had any problem yet with my > 'slash and burn' approach. It removed it from the 'Install/Uninstall' > list with windows so it seems to have be removed and the disk space that 2.13.2 took up has been reclaimed. > > Hope this helps. Let me know if you find any more definitive answers. > > Thanks. > > Kevin > > -Original Message- > From: Cem Girit [mailto:gi...@comcast.net] > Sent: Saturday, November 12, 2011 6:33 PM > To: 'Kevin Burton' > Subject: RE: [R] Upgrade R? > > Hello Kevin, > >I am getting the same error "utCompiledCode..." since I > installed > R2.14 while R2.13 existed. How did you get rid of R2.13 eventually? > Did you just delete it? If so, how did you clean the registry? > >Thank you, > > Cem > > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...
Re: [R] Upgrade R?
Hello Kevin, Thank you. I will delete the folder and run an application called CCleaner (free). That will remove all the broken registry entries. There should be a problem free update path for R installation. As you rightfully mentioned the R- manual is not clear about package update issues. I received many helpful suggestions on the update path but some of the them were contradictory in the order of steps to be taken. I am also using statConn (DCOM) interface for programming. So my problems are multifold. I will compile the answers I received on the R version update issue and publish them so that that the experts could put them into more effective use. Sincerely, Cem -Original Message- From: Kevin Burton [mailto:rkevinbur...@charter.net] Sent: Sunday, November 13, 2011 4:11 PM To: 'Cem Girit' Subject: RE: [R] Upgrade R? I don't know if it was correct but I just removed the directory and then searched and removed all instances in the registry that referred to 2.13.1 (in my case searching for this seemed to only return references to 'R'). I have since been given some links that address specific registry entries but I haven't had any problem yet with my 'slash and burn' approach. It removed it from the 'Install/Uninstall' list with windows so it seems to have be removed and the disk space that 2.13.2 took up has been reclaimed. Hope this helps. Let me know if you find any more definitive answers. Thanks. Kevin -Original Message- From: Cem Girit [mailto:gi...@comcast.net] Sent: Saturday, November 12, 2011 6:33 PM To: 'Kevin Burton' Subject: RE: [R] Upgrade R? Hello Kevin, I am getting the same error "utCompiledCode..." since I installed R2.14 while R2.13 existed. How did you get rid of R2.13 eventually? Did you just delete it? If so, how did you clean the registry? Thank you, Cem -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin Burton Sent: Thursday, November 10, 2011 11:54 AM To: 'jose Bartolomei'; 'R Help' Subject: Re: [R] Upgrade R? The problem with this documentation is two-fold. One it seems to concentrate on building from source which I don't need. Two it doesn't address the upgade. I have a number of packages and so I need to do what has been suggested and install the latest version *first*. Then copy the libraries (packages). Then uninstall the previous version. It is on this last step that I am stuck on right now. The last link on uninstalling R manually was what I needed. Thank you. Kevin From: jose Bartolomei [mailto:surfpr...@hotmail.com] Sent: Thursday, November 10, 2011 10:19 AM To: rkevinbur...@charter.net; R Help Subject: RE: [R] Upgrade R? Hi, Don't know if this will help you but... In my short experience and following the guidelines you should first uninstall R. http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window s Unistall it from the Windows control panel. The old R version libraries file will be kept on machine. For example : C:\Program Files\R\R-2.13.0\library Then install the new version via: http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window s You can copy/paste libraries from the old version R library file to the new one. C:\Program Files\R\R-2.14.0\library There is too an function named: ?update.packagee If above was what you did, then there is a post on Uninstalling R manually: http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=wiki:uninstalling_r _manually Regards, Jose > From: rkevinbur...@charter.net > To: r-help@r-project.org > Date: Thu, 10 Nov 2011 09:07:20 -0600 > Subject: Re: [R] Upgrade R? > > Since apparently there is no one familiar with this error message let > me rephrase the question. Is there a 'manual' process to fully remove > a version > of 'R' from my machine? This is a Window PC running Windows 7. > > > > Thank you. > > > > Kevin > > > > From: Kevin Burton [mailto:rkevinbur...@charter.net] > Sent: Monday, November 07, 2011 2:23 PM > To: 'r-help@r-project.org' > Subject: Upgrade R? > > > > I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the > libraries from the 'library' directory in my existing installation (2.13.1) > to the installed R 2.14. Now I want to uninstall the old installation > (R > 2.13.1) and I get the error: > > > > Internal Error: Cannot find utCompiledCode record for this version of > the uninstaller. > > > > Any ideas? > > > > Kevin > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list
Re: [R] Web based R-help not a list
ell. These could all be avoided. How about hypertext links in text based posts? I could just click on them to achieve the intent rather than copying the link which in general is broken on the second line to a browser. And if the site offers a posting medium ( I do not care what it is) in which I can format my posts for better impact such that the answerers can understand easily, and be able to attach pictures so that the numbers of words I use would be reduced 1000 times, and where my typos would be corrected, etc. etc. And such a site will not limit anybody just to stick to plain text. Many R-Help users answered the questions I posted on this topic with calm. I hope that I did not insult the feelings of some of you on this very "sensitive" issue. I will continue to use this site to get help and eventually to give help. I am very grateful to all who answered many of my questions how stupid or sensitive they were. Humbly yours. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, November 09, 2011 6:22 PM To: Cem Girit Cc: r-help@r-project.org Subject: Re: [R] Web based R-help not a list On Nov 9, 2011, at 5:38 PM, Cem Girit wrote: > Hello, > >Is there a web version of this R-Help user group (such > as the ones under Google Groups) such tha There is Nabble. It's not going to make you any friends unless you learn to post in plain text AND to include context ... too often not done by Nabble users. Gmane is also a possible website that can mirror rhelp. > > 1. I can do a search on any topic over thousands of posts on R > easily > and effectively Yes, several. Have you read the information page and the posting guide yet? > > 2. My mailbox do not overflow with emails so that I do not > need to > edit it every day Yes. You were offered an option to get a digest when you signed up. > > 3. I can arrange to receive only the responses to my posts > automatically Most people reply to both the poster and the the list, but there is no enforcement mechanism. Your unwillingness to do any extra work to educate yourself is duly noted. Speaking only for myself, I will NOT respond to any of your further posts because of your demonstrated privileged attitude. It would not bother me if other regular readers followed my example. > > 4. The content of the post might be better formatted for more > information other than just the text (we now have HTML!) We do not agree that HTML is a better format. You are welcome to take your questions elsewhere if plain text is not acceptable. > > 5. I can attach pictures to my posts for questions related to > plots, > results etc. be quick and effective rather than just links to other > sites .pdf and .txt files are acceptable attachments. > > > [[alternative HTML version deleted]] I say again: You are welcome to take your questions elsewhere if plain text is not acceptable. -- David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ 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.
[R] Web based R-help not a list
Hello, Is there a web version of this R-Help user group (such as the ones under Google Groups) such that 1. I can do a search on any topic over thousands of posts on R easily and effectively 2. My mailbox do not overflow with emails so that I do not need to edit it every day 3. I can arrange to receive only the responses to my posts automatically 4. The content of the post might be better formatted for more information other than just the text (we now have HTML!) 5. I can attach pictures to my posts for questions related to plots, results etc. be quick and effective rather than just links to other sites Sincerely, Cem Girit [[alternative HTML version deleted]] __ 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.
[R] List of user installed packages
Hello, I am going to install the new version of R 2.14.1. After the installation, I want to copy my installed packages to the new library. But since over time I forgot which ones I installed I want to get a list of all the packages I installed among the packages installed initially by the R-installer. Is this possible? Cem Cem Girit, PhD Biopticon Corporation 182 Nassau Street, Suite 204 Princeton, NJ 08542 Tel: (609)-853-0231 Email:gi...@biopticon.com [[alternative HTML version deleted]] __ 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.
[R] Parametric tests
Hello, I am interested in parametric multi comparison tests such as Dunnett, Duncan, Tukey, Newman-Keuls, Bonferonni, Scheffe, and non-parametric tests such as Kruskal-Wallis, and Mann-Whitney U. Are there packages that include most of these tests in each category? Many packages exist for an individual test but their outputs vary in great detail (test statistics, p-values, etc.) formats. It is desirable to have one that allows comparison of different test results such as Tukey versus Duncan. Cem Cem Girit [[alternative HTML version deleted]] __ 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] Survival analysis
Hello Terri, Thank you very much. This is the answer I needed. Could you also tell me how I can calculate 25 and 50% quantiles in R? I can only get median as far as I know. Cem Cem Girit -Original Message- From: Terry Therneau [mailto:thern...@mayo.edu] Sent: Monday, October 24, 2011 10:21 AM To: r-help@r-project.org Cc: Cem Girit Subject: Re: Survival analysis On Sun, 2011-10-23 at 12:00 +0200, r-help-requ...@r-project.org wrote: > The results by the survfit routine do not agree with the > results of these formulae as obtained by SAS. > The next question should be "is SAS correct". The answer in this case is no. For survival data the mean is computed as the area under S(t), the survival curve. This is how you deal with censoring. But becasue survival curves often don't fall all the way to zero, one must deal with the question of how far to the right the integral should go. The help file for print.survfit has a short discussion of three possible options available in R; two are pretty good, the third I consider more problematic, but it is found in some textbooks. I would rank the approach used by SAS in fourth position and have chosen not to implement it. Assume a curve has its last death at time 43, but 3 others who survive to time 59, 60 and 62 (this is the curve for your second group). To compute the mean, SAS replaces those three subjects with 3 deaths at time 43. So it gets a mean < 43 (surprise!), while R gives a more sensible answer. If you had 100 subjects followed for 50 years, all still alive but one (who died at year 2), the SAS answer would be a mean survival of 2 years. Terry Therneau __ 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.
[R] FW: Survival analysis
Hello Sarah and David, Thank you for your help. I followed your advice and suggestions. But I still have problems with the R-results: 1) Mean Survival Time and the Error of the Mean: The mean survival time calculation is not just taking the average of the survival times as you have suggested. The mean survival time is defined as Mean=sum(S(ti-1)*(ti-ti-1)) for i=0 to D Where S(Ti) is the survival probability, ti are the event times, D is the last event. And the standard error of the mean as Standard error= sqrt((m/(m-1))*sum(Ai^2*di/(ni*(ni-di))), sum is for i=1 to D-1 where Ai=sum(S(tj)*(tj+1-tj), for j=i to D-1, d is the number of death cases, n is the number at risk, m=sum(dj) for j=1 to D. The results by the survfit routine do not agree with the results of these formulae as obtained by SAS. R results: - > print(fit,print.rmean=TRUE) Call: survfit(formula = Surv(dT, vT) ~ gT, conf.type = "log-log") records n.max n.start events *rmean *se(rmean) median 0.95LCL gT=DrugA 9 9 96 50.0 3.11 48 32 gT=DrugB 9 9 93 54.8 2.93 NA 42 gT=DrugC 9 9 9 4 53.8 2.74 NA 42 gT=Vehicle 9 9 98 42.3 2.38 40 37 SAS results: -- Group Total Failed Censored% Censored Mean Survival Time Standard Error of Survival Time Drug A 9 6 3 33.33 48. 2.6931 Drug B 9 3 6 66.67 42.7778 0.1697 Drug C 9 4 5 55.56 46. 0.7258 Vehicle 9 8 1 11.11 40.5556 1.1283 Total 36 21 15 41.67 2. Quantiles The survfit routines produces the median and the 95% Confidence intervals but not 25% and 75% quantiles. Or maybe it does, but I do not know how to calculate and extract them from its output. SAS results: Quartile Estimates Drug A Point Estimate95% Confidence Interval Transform Lower Upper 75 LOGLOG 46 Median 48 LOGLOG 32 25 45 LOGLOG 32 48 Drug B Point Estimate 95% Confidence Interval Transform Lower Upper 75 LOGLOG Median LOGLOG 42 25 43 LOGLOG 42 Drug C Point Estimate 95% Confidence Interval Transform Lower Upper 75 LOGLOG x Median LOGLOG 42 47 25 47 LOGLOG 42 Vehicle Point Estimate 95% Confidence Interval Transform Lower Upper 75 44 LOGLOG 38 Median 40 LOGLOG 37 45 25 38 LOGLOG 37 40 The data and the code I used for these calculations are given below: > dT [1] 37 41 40 38 38 37 44 45 48 43 48 46 54 60 32 45 55 62 42 62 62 62 47 42 59 43 [27] 60 60 51 43 50 51 47 42 47 51 > vT [1] 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 > gT [1] Vehicle Vehicle Vehicle Vehicle Vehicle Vehicle Vehicle Vehicle Vehicle [10] DrugA DrugA DrugA DrugA DrugA DrugA DrugA DrugA DrugA [19] DrugB DrugB DrugB DrugB DrugB DrugB DrugB DrugB DrugB [28] DrugC DrugC DrugC DrugC DrugC DrugC DrugC DrugC DrugC Levels: DrugA DrugB DrugC Vehicle > fit<-survfit(Surv(dT,vT)~gT,conf.type="log-log",conf.int=0.95) > print(fit,print.rmean=TRUE) > print(fit,print.rmean=TRUE) Call: survfit(formula = Surv(dT, vT) ~ gT, conf.type = "log-log", conf.int = 0.95) records n.max n.start events *rmean *se(rmean) median 0.95LCL 0.95UCL gT=DrugA 9 9 9 6 50.0 3.11 48 32 NA gT=DrugB 9 9 9 3 54.8 2.93 NA 42 NA gT=DrugC 9 9 9 4 53.8 2.74 NA 42 NA gT=Vehicle 9 9 9 8 42.3 2.38 40 37 45 * restricted mean with upper limit = 61 > Sincerely, Cem Girit -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, October 20, 2011 6:25 PM To: Sarah Goslee Cc: Cem Girit; r-help Subject: Re: [R] Survival a
[R] Survival analysis
Hello, I need some results from the survival analysis of my data that I do not know whether exist in Survival Package or how to obtain if they do: 1. The Mean survival time 2. The standard error of the mean 3. Point and 95% Lower & Upper Confidence Intervals estimates Any help will be greatly appreciated. Cem [[alternative HTML version deleted]] __ 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.
[R] r-Help web site access problem
Hello, I cannot access the r-help website although after registration I am getting all the posts sent to the side. Each time I click on the "Visit Subscriber List" on the https://stat.ethz.ch/mailman/listinfo/r-help site, I get "R-help roster authentication failed." error. Any ideas? Cem [[alternative HTML version deleted]] __ 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.
[R] Extracting results from a function output
Hello, I am having hard time obtaining a value from a function. "fit" is a survival function that produces some results, such as "median", "confidence intervals" etc. But str() function does not list these values. How can I extract these to be able use them? For example, I need "median" value for the group DrugA which is 48. "Print" function does not reveal them either. Thank you. > fit Call: survfit(formula = Surv(tT, dT) ~ gT, conf.type = "log-log") records n.max n.start events median 0.95LCL 0.95UCL gT=DrugA 9 9 9 6 48 32 NA gT=DrugB 9 9 9 3 NA 42 NA gT=DrugC 9 9 9 4 NA 42 NA gT=Vehicle 9 9 9 8 40 37 45 > str(fit) List of 14 $ n : int [1:4] 9 9 9 9 $ time : num [1:28] 32 43 45 46 48 54 55 60 62 42 ... $ n.risk : num [1:28] 9 8 7 6 5 4 3 2 1 9 ... $ n.event : num [1:28] 1 1 1 1 1 0 1 0 0 2 ... $ n.censor : num [1:28] 0 0 0 0 0 1 0 1 1 0 ... $ surv : num [1:28] 0.889 0.778 0.667 0.556 0.444 ... $ type : chr "right" $ strata : Named int [1:4] 9 6 6 7 ..- attr(*, "names")= chr [1:4] "gT=DrugA" "gT=DrugB" "gT=DrugC" "gT=Vehicle" $ std.err : num [1:28] 0.118 0.178 0.236 0.298 0.373 ... $ upper : num [1:28] 0.984 0.939 0.878 0.805 0.719 ... $ lower : num [1:28] 0.433 0.365 0.282 0.204 0.136 ... $ conf.type: chr "log-log" $ conf.int : num 0.95 $ call : language survfit(formula = Surv(tT, dT) ~ gT, conf.type = "log-log") - attr(*, "class")= chr "survfit" Cem Cem Girit, PhD Biopticon Corporation 182 Nassau Street, Suite 204 Princeton, NJ 08542 Tel: (609)-853-0231 Email: <mailto:cgi...@biopticon.com> gi...@biopticon.com This email message and any attachments are confidential ...{{dropped:14}} __ 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.