Re: [R] comparing 2 long lists in R
Bogdan, I would look into bioconductor for packages handling this type choromosomal range data. cntools is one poped into my mind. Tao On Thursday, September 24, 2015 12:59 PM, Sarah Gosleewrote: merge() most likely, but: are these really lists in the R sense? The correct answer depends on what the format actually is; you need to use dput() or some other unambiguous way of providing sample data. Without a reproducible example that includes some sample data provided using dput() (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure out how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Thu, Sep 24, 2015 at 3:43 PM, Bogdan Tanasa wrote: > Dear all, > > please could you advise on a computationally quick way to compare and merge > 2 long lists in R; > the lists are of the following type, for example : > > <> in list 1 : > > chromosome, coordinateA, coordinateB, value1 > chromosome, coordinateC, coordinateC, value2, > etc > > <> in list 2 : > > chromosome, coordinateX, coordinateY, value6 > chromosome, coordinateZ, coordinateT, value8, > etc > > In the unified list, if coordinateA=coordinateX, and > coordinateB=coordinateY, then we write : > > chromosome, coordinateA, coordinateB, value1, coordinateX, coordinateY, > value6, > > otherwise, we write the individual values : > > chromosome, coordinateA, coordinateB, value1, > chromosome, coordinateX, coordinateY, value6, > > thanks, > > bogdan > > [[alternative HTML version deleted]] > and please don't post in HTML. -- Sarah Goslee http://www.functionaldiversity.org __ 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-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.
Re: [R] how to change the ff properties of a ff-related R object after the original ff output folder has been moved
Hi Jens, Thanks for the example! I can see that you can change the 'filename' attribute for a ff object one-by-one, but is there a way to issue one command that will automatically change the attribute to all the ff objects in your workspace, as you can imagine when I have large number of objects like this, doing one-by-one is cumbersome? After all, all it needs to change is the folder path, right? May be this is a too wishful thinking :-) Best, Tao On Friday, June 26, 2015 3:31 AM, Jens Oehlschlägel jens.oehlschlae...@truecluster.com wrote: Tao, I do assume that the ff-files are still at some location and not deleted by a finalizer. The following explains how to manipulate file locations with ff and ffdf objects. Kind regards jens library(ff) path1 - c:/tmp path2 - c:/tmp2 # create ffdf, # using non-standard path sets finalizer to 'close' instead of 'delete' fdf1 - as.ffdf(iris, col_args=list(pattern=file.path(path1,iris))) # let's copy the old metadata (but not the files, useclone for that) # using ffs hybrid copying semantics fdf2 - fdf1 # note both are open is.open(fdf1) is.open(fdf2) # close the files close(fdf1) # and note that is.open(fdf1) is.open(fdf2) # the magic has kept physical metadata in synch even in the copy # (virtual metadata is not kept in synch # which allows different virtual views into the same files # not unlike SQL VIEWs virtualize dastabase TABLEs) # filename on a ffdf filename(fdf2) # is a shortcut for lapply(physical(fdf2), filename) # so filename is a physical attribute # actually moving the files can be done with the filename- method lapply(physical(fdf2), function(x)filename(x) - sub(path1, path2, filename(x))) # check this filename(fdf1) filename(fdf2) # filename on ff filename(fdf1$Species) # is a shortcut for attr(attr(fdf1$Species, physical), filename) # and if you directly manipulate this attribute # you circummvent the filename method # and the file itself will not be moved attr(attr(fdf1$Species, physical), filename) - sub(path2, path1, filename(fdf1$Species)) # now the metadata points to a different location filename(fdf1$Species) # note that this physical attribute was also changed # for the copy filename(fdf2$Species) # of course you can fix the erroneous metadata by attr(attr(fdf1$Species, physical), filename) - sub(path1, path2, filename(fdf1$Species)) # or for all columns in a ffdf by lapply(physical(fdf2), function(x)attr(attr(x, physical), filename) - sub(path2, path1, filename(x))) # now we have your situation with broken metadata open(fdf2) # and can fix that by lapply(physical(fdf2), function(x)attr(attr(x, physical), filename) - sub(path1, path2, filename(x))) # check open(fdf2) Am 26.06.2015 um 01:04 schrieb Shi, Tao: Hi all, I'm new to ff package through the using Bioconductor package crlmm. Here is my problem: I've created a few R objects (e.g. an CNSet) using crlmm based on my data and save them in a .RData file. crlmm heavily uses ff package to store results on a local folder. For certain reasons, I have moved the ff output folder to somewhere else. Now when I go back to R, I can't open those CNSet, for example, anymore, as the file has a property still storing the old ff output folder path. My question is: is there a quick way to change these paths to the new one, so I don't have to re-run the own analysis. Many thanks! Tao [[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.
Re: [R] how to change the ff properties of a ff-related R object after the original ff output folder has been moved
Hi David, Normally, I would have a R code example for this, but since I'm new to this too and just didn't have time to do that. Hopefully, Jen's code illustrates the problem. Tao On Thursday, June 25, 2015 8:53 PM, David Winsemius dwinsem...@comcast.net wrote: On Jun 25, 2015, at 4:04 PM, Shi, Tao via R-help wrote: Hi all, I'm new to ff package through the using Bioconductor package crlmm. Here is my problem: I've created a few R objects (e.g. an CNSet) using crlmm based on my data and save them in a .RData file. crlmm heavily uses ff package to store results on a local folder. For certain reasons, I have moved the ff output folder to somewhere else. Now when I go back to R, I can't open those CNSet, for example, anymore, as the file has a property still storing the old ff output folder path. My question is: is there a quick way to change these paths to the new one, so I don't have to re-run the own analysis. The way to approach this is to create a small example that illustrates teh problem. In many case all will becove clear, but if not then you will have something that you can then post ... IN R CODE ... that will let us (most of whom are not ff-urers) see the problem. -- David Winsemius Alameda, CA, USA [[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] how to change the ff properties of a ff-related R object after the original ff output folder has been moved
Hi all, I'm new to ff package through the using Bioconductor package crlmm. Here is my problem: I've created a few R objects (e.g. an CNSet) using crlmm based on my data and save them in a .RData file. crlmm heavily uses ff package to store results on a local folder. For certain reasons, I have moved the ff output folder to somewhere else. Now when I go back to R, I can't open those CNSet, for example, anymore, as the file has a property still storing the old ff output folder path. My question is: is there a quick way to change these paths to the new one, so I don't have to re-run the own analysis. Many thanks! Tao __ 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] Error in title(...) : X11 font ....
Hi list, Could anybody help me to explain the following error message and fix it? Thank you very much! Tao sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base plot(1:10, xlab=haha) plot(1:10, ylab=haha) plot(1:10, main=haha) Error in title(...) : X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 2 at size 14 could not be loaded __ 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] Rtools 3.3 is not compatible with R 3.2.0.?
hi list, Any updates on this issue? Thank you very much! Tao devtools::install_github(rstudio/packrat) WARNING: Rtools 3.3 found on the path at c:/Rtools is not compatible with R 3.2.0. Please download and install Rtools 3.1 from http://cran.r-project.org/bin/windows/Rtools/, remove the incompatible version from your PATH, then run find_rtools(). Downloading github repo rstudio/packrat@master Installing packrat C:/PROGRA~1/R/R-32~1.0/bin/x64/R --vanilla CMD INSTALL \ C:/Users/tshi/AppData/Local/Temp/Rtmp6VYlhX/devtools25dc273e706c/rstudio-packrat-42b76ad --library=C:/Program Files/R/R-3.2.0/library \ --install-tests * installing *source* package 'packrat' ... ** R ** inst ** tests ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (packrat) find_rtools() WARNING: Rtools 3.3 found on the path at c:/Rtools is not compatible with R 3.2.0. Please download and install Rtools 3.1 from http://cran.r-project.org/bin/windows/Rtools/, remove the incompatible version from your PATH, then run find_rtools(). sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] devtools_1.7.0 packrat_0.4.3-19 loaded via a namespace (and not attached): [1] httr_0.6.1 tools_3.2.0RCurl_1.95-4.5 stringr_0.6.2 bitops_1.0-6 __ 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.
Re: [R] interactive labeling/highlighting on multiple xy scatter plots
This is new to me. Thanks for suggesting! Tao On Friday, August 1, 2014 3:05 AM, Michael Lawrence lawrence.mich...@gene.com wrote: You should check out the animint package. https://github.com/tdhock/animint On Mon, Jul 28, 2014 at 5:48 PM, Shi, Tao shida...@yahoo.com wrote: hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions. I plotted them in several different xy scattter plots. It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown. I know brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the results to the collaborators and let them to play with it without the need of installing R or ggobi on their machine). rCharts is nice but so far it can only create one scatter plot at a time. Any good suggestions? Many thanks! Tao __ 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, reproducible code.
Re: [R] interactive labeling/highlighting on multiple xy scatter plots
Just saw this from the Rstudio webinar too. Will explore it more. Thanks! Tao On Thursday, July 31, 2014 11:11 AM, Greg Snow 538...@gmail.com wrote: The brushing may only be available in the development version of ggvis. See here for the example: https://github.com/rstudio/webinars/tree/master/2014-01 On Thu, Jul 31, 2014 at 10:17 AM, Shi, Tao shida...@yahoo.com wrote: I looked at ggvis briefly before, but didn't notice its brushing capability. Now you explained. Thanks, both! Tao On Wednesday, July 30, 2014 9:50 AM, Ramnath Vaidyanathan ramnath.vaidyanat...@mcgill.ca wrote: ggvis is an excellent option to do this kind of stuff. The only limitation currently is that all sorts of interactivity (tooltips, brushing etc.) are done on the server side using Shiny. So you have to upload your HTML to a shiny server for the interactivity to work. Best, Ramnath __ Ramnath Vaidyanathan Assistant Professor of Operations Management Desautels Faculty of Management 1001 Sherbrooke Street West Montreal, QC H3A 1G5 Ph: +1 (514) 398-1457 __ On Wed, Jul 30, 2014 at 12:45 PM, Greg Snow 538...@gmail.com wrote: Another option that is in developement, but may do what you want is ggvis (http://ggvis.rstudio.com/). I have seen an example of brushing created with ggvis that can then be embedded in a web page. I am not sure if you can send the html and support files directly to someone without R (probably Rstudio) or if you need to upload it to a server for others to see, but the later is still an option for collaborators who do not have R installed. On Tue, Jul 29, 2014 at 2:13 PM, Shi, Tao shida...@yahoo.com wrote: Thank you very much, Greg and Ramnath, for the pointers! I'll explore more. On Tuesday, July 29, 2014 8:10 AM, Ramnath Vaidyanathan ramnath.vaidyanat...@mcgill.ca wrote: There are plugins for rCharts that help you create custom charts. Here is a scatterplot matrix example http://mostlyconjecture.com/2014/02/09/scatterplot-matrix-with-rcharts/ It doesn't support brushing, but I think it won't be hard adding that behavior if you contact its author. Hope this helps. Best, Ramnath __ Ramnath Vaidyanathan Assistant Professor of Operations Management Desautels Faculty of Management 1001 Sherbrooke Street West Montreal, QC H3A 1G5 Ph: +1 (514) 398-1457 __ On Tue, Jul 29, 2014 at 11:01 AM, Greg Snow 538...@gmail.com wrote: There is the TkBrush function in the TeachingDemos package that gives brushing in a scatterplot matrix using a Tk interface rather than ggobi. There is also the iplots package which allows you to create multiple scatterplots, histograms, boxplots, barcharts, etc. and points selected in any one of the plots will then be highlighted in all the others. Both of those solutions require R to be installed. I don't know of any way to get what you want without installing at least one of ggobi or R (or some other program of similar complexity to install). On Mon, Jul 28, 2014 at 6:48 PM, Shi, Tao shida...@yahoo.com wrote: hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions. I plotted them in several different xy scattter plots. It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown. I know brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the results to the collaborators and let them to play with it without the need of installing R or ggobi on their machine). rCharts is nice but so far it can only create one scatter plot at a time. Any good suggestions? Many thanks! Tao __ 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com -- Gregory (Greg) L. Snow Ph.D. 538...@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.
Re: [R] interactive labeling/highlighting on multiple xy scatter plots
I looked at ggvis briefly before, but didn't notice its brushing capability. Now you explained. Thanks, both! Tao On Wednesday, July 30, 2014 9:50 AM, Ramnath Vaidyanathan ramnath.vaidyanat...@mcgill.ca wrote: ggvis is an excellent option to do this kind of stuff. The only limitation currently is that all sorts of interactivity (tooltips, brushing etc.) are done on the server side using Shiny. So you have to upload your HTML to a shiny server for the interactivity to work. Best, Ramnath __ Ramnath Vaidyanathan Assistant Professor of Operations Management Desautels Faculty of Management 1001 Sherbrooke Street West Montreal, QC H3A 1G5 Ph: +1 (514) 398-1457 __ On Wed, Jul 30, 2014 at 12:45 PM, Greg Snow 538...@gmail.com wrote: Another option that is in developement, but may do what you want is ggvis (http://ggvis.rstudio.com/). I have seen an example of brushing created with ggvis that can then be embedded in a web page. I am not sure if you can send the html and support files directly to someone without R (probably Rstudio) or if you need to upload it to a server for others to see, but the later is still an option for collaborators who do not have R installed. On Tue, Jul 29, 2014 at 2:13 PM, Shi, Tao shida...@yahoo.com wrote: Thank you very much, Greg and Ramnath, for the pointers! I'll explore more. On Tuesday, July 29, 2014 8:10 AM, Ramnath Vaidyanathan ramnath.vaidyanat...@mcgill.ca wrote: There are plugins for rCharts that help you create custom charts. Here is a scatterplot matrix example http://mostlyconjecture.com/2014/02/09/scatterplot-matrix-with-rcharts/ It doesn't support brushing, but I think it won't be hard adding that behavior if you contact its author. Hope this helps. Best, Ramnath __ Ramnath Vaidyanathan Assistant Professor of Operations Management Desautels Faculty of Management 1001 Sherbrooke Street West Montreal, QC H3A 1G5 Ph: +1 (514) 398-1457 __ On Tue, Jul 29, 2014 at 11:01 AM, Greg Snow 538...@gmail.com wrote: There is the TkBrush function in the TeachingDemos package that gives brushing in a scatterplot matrix using a Tk interface rather than ggobi. There is also the iplots package which allows you to create multiple scatterplots, histograms, boxplots, barcharts, etc. and points selected in any one of the plots will then be highlighted in all the others. Both of those solutions require R to be installed. I don't know of any way to get what you want without installing at least one of ggobi or R (or some other program of similar complexity to install). On Mon, Jul 28, 2014 at 6:48 PM, Shi, Tao shida...@yahoo.com wrote: hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions. I plotted them in several different xy scattter plots. It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown. I know brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the results to the collaborators and let them to play with it without the need of installing R or ggobi on their machine). rCharts is nice but so far it can only create one scatter plot at a time. Any good suggestions? Many thanks! Tao __ 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com -- Gregory (Greg) L. Snow Ph.D. 538...@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.
Re: [R] interactive labeling/highlighting on multiple xy scatter plots
Thank you very much, Greg and Ramnath, for the pointers! I'll explore more. On Tuesday, July 29, 2014 8:10 AM, Ramnath Vaidyanathan ramnath.vaidyanat...@mcgill.ca wrote: There are plugins for rCharts that help you create custom charts. Here is a scatterplot matrix example http://mostlyconjecture.com/2014/02/09/scatterplot-matrix-with-rcharts/ It doesn't support brushing, but I think it won't be hard adding that behavior if you contact its author. Hope this helps. Best, Ramnath __ Ramnath Vaidyanathan Assistant Professor of Operations Management Desautels Faculty of Management 1001 Sherbrooke Street West Montreal, QC H3A 1G5 Ph: +1 (514) 398-1457 __ On Tue, Jul 29, 2014 at 11:01 AM, Greg Snow 538...@gmail.com wrote: There is the TkBrush function in the TeachingDemos package that gives brushing in a scatterplot matrix using a Tk interface rather than ggobi. There is also the iplots package which allows you to create multiple scatterplots, histograms, boxplots, barcharts, etc. and points selected in any one of the plots will then be highlighted in all the others. Both of those solutions require R to be installed. I don't know of any way to get what you want without installing at least one of ggobi or R (or some other program of similar complexity to install). On Mon, Jul 28, 2014 at 6:48 PM, Shi, Tao shida...@yahoo.com wrote: hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions. I plotted them in several different xy scattter plots. It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown. I know brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the results to the collaborators and let them to play with it without the need of installing R or ggobi on their machine). rCharts is nice but so far it can only create one scatter plot at a time. Any good suggestions? Many thanks! Tao __ 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. -- Gregory (Greg) L. Snow Ph.D. 538...@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] interactive labeling/highlighting on multiple xy scatter plots
hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions. I plotted them in several different xy scattter plots. It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown. I know brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the results to the collaborators and let them to play with it without the need of installing R or ggobi on their machine). rCharts is nice but so far it can only create one scatter plot at a time. Any good suggestions? Many thanks! Tao __ 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] tab auto-fill and arrow keys are not working in R on a linux cluster
Thank you, Jeff! I'll try that. Tao On Tuesday, June 3, 2014 5:22 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: FAQ 7.20 --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On June 3, 2014 4:47:58 PM PDT, Shi, Tao shida...@yahoo.com wrote: Hi List, We have R 3.1.0 installed on the head node of our linux cluster, but the tab auto-complete and the arrow keys are not working. When I was trying to use the up/down arrow key to scroll through the old command history I got something like this. Any ideas on what's going on here? Many thanks! Tao sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C [3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915 [5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915 [7] LC_PAPER=en_US.iso885915 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base ^[[A^[[A^[[A^[[A Error: unexpected input in __ 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, reproducible code.
[R] tab auto-fill and arrow keys are not working in R on a linux cluster
Hi List, We have R 3.1.0 installed on the head node of our linux cluster, but the tab auto-complete and the arrow keys are not working. When I was trying to use the up/down arrow key to scroll through the old command history I got something like this. Any ideas on what's going on here? Many thanks! Tao sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C [3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915 [5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915 [7] LC_PAPER=en_US.iso885915 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base ^[[A^[[A^[[A^[[A Error: unexpected input in __ 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] code folding for both TeX sections and R code chunks in .rnw file
Hi list, Sorry, this is not a question directly for R, rather for R code editor. I'm posting it here to capture wider audience. The problem I'm facing is that as sometimes my .rnw file gets bigger and bigger, navigating through it becomes an issue. Scrolling back-n-forth or remembering the line number of the section you want to go to are just not efficient. It would be nice for the text editor to show a table of content tree NOT ONLY for .tex section/subsection headers BUT ALSO for R code chunks. It's kind of like what WinEdt is doing for .tex file but also adding R code chunks into the tree. (please see the first figure on http://www.winedt.com/snap.html ). Rstudio does pretty good job on folding R code, but not the .tex section headers. What are your best solutions? Thanks! Tao __ 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] XML package installation -- an old question
Hi list, I have encountered the Cannot find xml2-config problem too during XML package installation on my 64-bit Redhat (v. 6.4) linux machine. After looking through the old posts I checked all the necessary libraries and they all seem to be properly installed (see below). I don't understand why R can't see the xml2-confg during the installation process. Help, please! Many thanks! Tao == [root ~]# yum install libxml2 Setting up Install Process Package matching libxml2-2.7.6-8.el6_3.3.x86_64 already installed. Checking for update. Nothing to do [root ~]# yum install libxml2-devel Setting up Install Process Package matching libxml2-devel-2.7.6-8.el6_3.3.x86_64 already installed. Checking for update. Nothing to do [root ~]# xml2-config --version 2.7.6 [root ~]# curl-config --version libcurl 7.19.7 R session == install.packages(XML) Installing package into \u2018/usr/lib64/R/library\u2019 (as \u2018lib\u2019 is unspecified) trying URL 'http://cran.stat.ucla.edu/src/contrib/XML_3.98-1.1.tar.gz' Content type 'application/x-tar' length 1582216 bytes (1.5 Mb) opened URL == downloaded 1.5 Mb * installing *source* package \u2018XML\u2019 ... ** package \u2018XML\u2019 successfully unpacked and MD5 sums checked checking for gcc... gcc checking for C compiler default output file name... rm: cannot remove `a.out.dSYM': Is a directory a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for sed... /bin/sed checking for pkg-config... /usr/bin/pkg-config checking for xml2-config... no Cannot find xml2-config ERROR: configuration failed for package \u2018XML\u2019 * removing \u2018/usr/lib64/R/library/XML\u2019 The downloaded source packages are in \u2018/tmp/RtmpwnAIFH/downloaded_packages\u2019 Updating HTML index of packages in '.Library' Making 'packages.html' ... done Warning message: In install.packages(XML) : installation of package \u2018XML\u2019 had non-zero exit status sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] BiocInstaller_1.10.3 loaded via a namespace (and not attached): [1] tcltk_3.0.1 tools_3.0.1 __ 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] XML package installation -- an old question
Hi Duncan, Thank you very much for your quick response! It turns out I was typing the shell commands in another xterm which was ssh'ed to another linux computer and I completely forgot about it. After finding that out and checking with my own computer, the libxml2 is installed but libxml2-devel is missing. Installation libxml2-devel solved the problem. My mistake! Sorry about that. Tao - Original Message - From: Duncan Temple Lang dtemplel...@ucdavis.edu To: r-help@r-project.org Cc: Sent: Thursday, August 15, 2013 10:38 AM Subject: Re: [R] XML package installation -- an old question Hi Tao In the same R session as you call install.packages(), what does system(which xml2-config, intern = TRUE) return? Basically, the error message from the configuration script for the XML package is complaining that it cannot find the executable xml2-config in your PATH. (You can also send _me_ the config.log file from the attempted installation.) D. On 8/15/13 10:13 AM, Shi, Tao wrote: Hi list, I have encountered the Cannot find xml2-config problem too during XML package installation on my 64-bit Redhat (v. 6.4) linux machine. After looking through the old posts I checked all the necessary libraries and they all seem to be properly installed (see below). I don't understand why R can't see the xml2-confg during the installation process. Help, please! Many thanks! Tao == [root ~]# yum install libxml2 Setting up Install Process Package matching libxml2-2.7.6-8.el6_3.3.x86_64 already installed. Checking for update. Nothing to do [root ~]# yum install libxml2-devel Setting up Install Process Package matching libxml2-devel-2.7.6-8.el6_3.3.x86_64 already installed. Checking for update. Nothing to do [root ~]# xml2-config --version 2.7.6 [root ~]# curl-config --version libcurl 7.19.7 R session == install.packages(XML) Installing package into \u2018/usr/lib64/R/library\u2019 (as \u2018lib\u2019 is unspecified) trying URL 'http://cran.stat.ucla.edu/src/contrib/XML_3.98-1.1.tar.gz' Content type 'application/x-tar' length 1582216 bytes (1.5 Mb) opened URL == downloaded 1.5 Mb * installing *source* package \u2018XML\u2019 ... ** package \u2018XML\u2019 successfully unpacked and MD5 sums checked checking for gcc... gcc checking for C compiler default output file name... rm: cannot remove `a.out.dSYM': Is a directory a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for sed... /bin/sed checking for pkg-config... /usr/bin/pkg-config checking for xml2-config... no Cannot find xml2-config ERROR: configuration failed for package \u2018XML\u2019 * removing \u2018/usr/lib64/R/library/XML\u2019 The downloaded source packages are in \u2018/tmp/RtmpwnAIFH/downloaded_packages\u2019 Updating HTML index of packages in '.Library' Making 'packages.html' ... done Warning message: In install.packages(XML) : installation of package \u2018XML\u2019 had non-zero exit status sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] BiocInstaller_1.10.3 loaded via a namespace (and not attached): [1] tcltk_3.0.1 tools_3.0.1 __ 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, 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
[R] compare objects in two different workspaces
Hi list, Is there a easy way to compare objects in two different workspace files (i.e. .RData files) in R? I can use some generic file compare softwares (e.g. BeyondCompare) to binary comparison, but when it says they're different you can't tell where the difference are from. Thanks! Tao __ 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] compare objects in two different workspaces
In fact, they have objects with exact same names. They were created by the same code at different time points. The code is not version-controlled, so I only have the most recent version, but I want to know what's changed. Tao - Original Message - From: Bert Gunter gunter.ber...@gene.com To: R. Michael Weylandt michael.weyla...@gmail.com Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org r-help@r-project.org Sent: Thursday, February 7, 2013 1:30 PM Subject: Re: [R] compare objects in two different workspaces ... but you need to load them into different environments in case they have objects with the same name, right? -- Bert On Thu, Feb 7, 2013 at 1:25 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Thu, Feb 7, 2013 at 5:53 PM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a easy way to compare objects in two different workspace files (i.e. .RData files) in R? I can use some generic file compare softwares (e.g. BeyondCompare) to binary comparison, but when it says they're different you can't tell where the difference are from. Load them both and compare within R? MW Thanks! Tao __ 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, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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] compare objects in two different workspaces
Thanks, Bert! Never used it, but reading it now. Tao - Original Message - From: Bert Gunter gunter.ber...@gene.com To: Shi, Tao shida...@yahoo.com Cc: R. Michael Weylandt michael.weyla...@gmail.com; r-help@r-project.org r-help@r-project.org Sent: Thursday, February 7, 2013 2:05 PM Subject: Re: [R] compare objects in two different workspaces Ummm... Have you actually read ?load to see how do this using the environment argument? -- Bert On Thu, Feb 7, 2013 at 1:58 PM, Shi, Tao shida...@yahoo.com wrote: In fact, they have objects with exact same names. They were created by the same code at different time points. The code is not version-controlled, so I only have the most recent version, but I want to know what's changed. Tao - Original Message - From: Bert Gunter gunter.ber...@gene.com To: R. Michael Weylandt michael.weyla...@gmail.com Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org r-help@r-project.org Sent: Thursday, February 7, 2013 1:30 PM Subject: Re: [R] compare objects in two different workspaces ... but you need to load them into different environments in case they have objects with the same name, right? -- Bert On Thu, Feb 7, 2013 at 1:25 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Thu, Feb 7, 2013 at 5:53 PM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a easy way to compare objects in two different workspace files (i.e. .RData files) in R? I can use some generic file compare softwares (e.g. BeyondCompare) to binary comparison, but when it says they're different you can't tell where the difference are from. Load them both and compare within R? MW Thanks! Tao __ 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, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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] what's this character?
Thank you, Jim, Peter, and John, for your help! Turns out it is a non-break space. No idea how it got there (the file is from somebody else). Thanks to Excel, I guess. Tao From: John j...@surewest.net To: r-help@r-project.org Cc: Shi, Tao shida...@yahoo.com Sent: Wednesday, November 28, 2012 10:17 PM Subject: Re: [R] what's this character? On Wed, 28 Nov 2012 16:44:59 -0800 (PST) Shi, Tao shida...@yahoo.com wrote: Hi list, I've encounter this problem (see below). I know it's particularly R-related and it's easy to get by but it still bothers me a lot. It looks the last character of N.C. is a space to me, but it's clearly not. Can someone tell me a way to figure out what character is in the last position. Thanks! Tao In the sample you provide it is HEX 20 which is ASCII for space. So either, it really is a space, or it didn't copy in your message. I would suggest copying the string and pasting into a hex editor. Doing that with the N.C. from your message yields: 22 4E 2E 43 2E 20 22 The 20 is the ASCII space character. Just possibly, if you are using a file saved in a unicode format, it could be a no-break space - Unicode point U+00A0, or UTF-8 c2 a0. Good luck. JWDougherty [[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] what's this character?
Hi list, I've encounter this problem (see below). I know it's particularly R-related and it's easy to get by but it still bothers me a lot. It looks the last character of N.C. is a space to me, but it's clearly not. Can someone tell me a way to figure out what character is in the last position. Thanks! Tao levels(dat$flag)[3] [1] N.C. levels(dat$flag)[3]==N.C. [1] FALSE substr(levels(dat$flag)[3],5,5) [1] substr(levels(dat$flag)[3],5,5)== [1] FALSE N.C. ==N.C. ## NOTE: this last one can't be reproduced after copy-n-paste [1] FALSE __ 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] warning message
Hi list, Can somebody explain why there are these warning messages? I just don't get it. I'm using R 2.15.1 on WinXP. Thanks! Tao x [1] -2.143510 -1.157450 -1.315581 1.033562 -1.225440 -1.179909 ifelse(x0, log2(x), -log2(-x)) [1] -1.099975 -0.210950 -0.395700 0.047625 -0.293300 -0.238675 Warning messages: 1: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced 2: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced __ 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] warning message
Never mind. I got it. Thanks! Tao - Original Message - From: Shi, Tao shida...@yahoo.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Monday, October 15, 2012 4:08 PM Subject: [R] warning message Hi list, Can somebody explain why there are these warning messages? I just don't get it. I'm using R 2.15.1 on WinXP. Thanks! Tao x [1] -2.143510 -1.157450 -1.315581 1.033562 -1.225440 -1.179909 ifelse(x0, log2(x), -log2(-x)) [1] -1.099975 -0.210950 -0.395700 0.047625 -0.293300 -0.238675 Warning messages: 1: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced 2: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced __ 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, reproducible code.
Re: [R] warning message
Thank you, Simon and Kevin! Tao - Original Message - From: Simon Knapp sleepingw...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Monday, October 15, 2012 4:25 PM Subject: Re: [R] warning message T he second and third arguments to ifelse are evaluated for all elements of x (producing your warnings), then the appropriate elements of each result are combined based on the (logical) values of the first argument to ifelse. On Tue, Oct 16, 2012 at 10:08 AM, Shi, Tao shida...@yahoo.com wrote: Hi list, Can somebody explain why there are these warning messages? I just don't get it. I'm using R 2.15.1 on WinXP. Thanks! Tao x [1] -2.143510 -1.157450 -1.315581 1.033562 -1.225440 -1.179909 ifelse(x0, log2(x), -log2(-x)) [1] -1.099975 -0.210950 -0.395700 0.047625 -0.293300 -0.238675 Warning messages: 1: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced 2: In ifelse(x 0, log2(x), -log2(-x)) : NaNs produced __ 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, reproducible code.
Re: [R] Sweave encoding option
Hi Yihui, Thanks for your quick reply! Yes, it was a long vacation, but definitely not long enough :-). Seriously, I have not changed my R, my tex engine etc. Nothing. And I was running the command just a couple of weeks ago and everything was fine. But now I need to specify this encoding option Still puzzled. Tao From: Yihui Xie x...@yihui.name To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, September 4, 2012 7:40 PM Subject: Re: [R] Sweave encoding option What happened might be that your vacation took too long. The encoding argument was introduced in R 2.13.1 (July last year). Nothing has changed in your Rnw document, but things have always been changing in R, so the best thing to do is to check out help(Sweave). Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Tue, Sep 4, 2012 at 7:02 PM, Shi, Tao shida...@yahoo.com wrote: Hi list, I was running Sweave on one of my .rnw file. Everything was fine, until I came back from the vacation. Nothing changed (at least to my knowledge), but now I have this problem:   Sweave(myfile.rnw) Error: âCOLO001final.rnwâ is not ASCII and does not declare an encoding After snooping around on the web, I found this solution: Sweave(myfile.rnw, encoding=utf8) Now everything works fine. Could somebody explain to me what happened? Why I need to specify the encoding now for it to work? What has changed (beyond my knowledge) in my computer that is causing this error? I'm running R 2.15.1 on WinXP. Thanks! Tao __ 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. [[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] Sweave encoding option
Hi list, I was running Sweave on one of my .rnw file. Everything was fine, until I came back from the vacation. Nothing changed (at least to my knowledge), but now I have this problem: Sweave(myfile.rnw) Error: ‘COLO001final.rnw’ is not ASCII and does not declare an encoding After snooping around on the web, I found this solution: Sweave(myfile.rnw, encoding=utf8) Now everything works fine. Could somebody explain to me what happened? Why I need to specify the encoding now for it to work? What has changed (beyond my knowledge) in my computer that is causing this error? I'm running R 2.15.1 on WinXP. Thanks! Tao __ 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] .rda vs. .RData
Thank you, all! From: Barry Rowlingson b.rowling...@lancaster.ac.uk To: Jeff Newmiller jdnew...@dcn.davis.ca.us Cc: Shi, Tao shida...@yahoo.com; Ista Zahn istaz...@gmail.com; r-help@r-project.org r-help@r-project.org Sent: Tuesday, April 24, 2012 12:36 AM Subject: Re: [R] .rda vs. .RData On Tue, Apr 24, 2012 at 12:51 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: My bad, I was thinking of rds (?saveRDS). RData and rda are mentioned under ?data as alternate file extensions for the same data format. Sorry for posting without checking first. Understandable mistake. Confusingly similar file extensions are confusingly similar. I'd have called them .Rob for the current .rds file format (single object), and .Ros for the current .rda file format (1 objects). [actually I would have called them .Rob or .Robject, and .Rwk or .Rworkspace but then I noticed that if you had a .Rob you had to have a .Ros so as not to favour one or other of the project originators :)] Barry [[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] load only one object from a .RData file
Hi list, Is there a way to load one specific object from a .RData file which contains multiple data objects? Thanks, ...Tao __ 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] load only one object from a .RData file
Thank you, Michael and Henrik. I'll try what you suggested. From: Henrik Bengtsson h...@biostat.ucsf.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, April 24, 2012 12:37 PM Subject: Re: [R] load only one object from a .RData file You could do: library(R.utils); value - loadToEnv(MyFile.RData)[[nameOfObject]]; It still load all of the data, but it is not kept; only the object you grab. /Henrik On Tue, Apr 24, 2012 at 11:30 AM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a way to load one specific object from a .RData file which contains multiple data objects? Thanks, ...Tao __ 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. [[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] .rda vs. .RData
Are they the same with .RData being the newer format? Thanks, ...Tao __ 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] barplot with both color and shading
Thank you both, Michael and Jim, for the answers! - Original Message - From: Michael Bibo michael_b...@health.qld.gov.au To: r-h...@stat.math.ethz.ch Cc: Sent: Wednesday, February 22, 2012 12:46 AM Subject: Re: [R] barplot with both color and shading Shi, Tao shidaxia at yahoo.com writes: Hi list, I want to draw a bar plot with color indicating one grouping and different shading on top of the color indicating another grouping. How should I proceed? Thanks! ...Tao Does this help? http://finzi.psych.upenn.edu/Rhelp10/2010-September/252219.html Michael Bibo michael_biboathealth.qld.gov.au __ 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, reproducible code.
[R] barplot with both color and shading
Hi list, I want to draw a bar plot with color indicating one grouping and different shading on top of the color indicating another grouping. How should I proceed? Thanks! ...Tao __ 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] barplot with both color and shading
Hi Michael, Thanks for your reply! I'm not sure if I was clear. I was really thinking about shading lines. I have just came up with a solution on my own: barplot(1:10, col=rep(0:1, each=5)) barplot(1:10, angle=20, density=c(0,20), col=2, add=T) Here is my initial failed attempt: barplot(1:10, angle=20, density=c(0,20), col=rep(0:1, each=5)) ...Tao - Original Message - From: R. Michael Weylandt michael.weyla...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, February 21, 2012 6:49 PM Subject: Re: [R] barplot with both color and shading T his seems like a natural fit for ggplot2 graphics, but I'm not aware of shading as a widely implemented graphical element: this might have some useful information -- http://had.co.nz/ggplot2/geom_histogram.html Can you find an example of shading in R? (perhaps in the R Graphics Gallery) If you look at example(barplot) there's an example of how to use different line patterns, but I don't find it particularly clear. The grouping techniques seem much clearer to me. Michael On Tue, Feb 21, 2012 at 5:24 PM, Shi, Tao shida...@yahoo.com wrote: Hi list, I want to draw a bar plot with color indicating one grouping and different shading on top of the color indicating another grouping. How should I proceed? Thanks! ...Tao __ 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, reproducible code.
Re: [R] extract worksheet names from an Excel file
Thanks, Gabor! That's really helpful! ...Tao - Original Message - From: Gabor Grothendieck ggrothendi...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Friday, June 24, 2011 5:02 AM Subject: Re: [R] extract worksheet names from an Excel file On Fri, Jun 24, 2011 at 12:41 AM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a R function I can use to extract the worksheet names from an Excel file? If no, any other automatic ways (not using R) to do this? thanks! Many or all of the Excel interfaces listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windowss=excel can do that but be careful since one or more the packages listed there always returns the sheet names sorted in alphabetical order which means that you can't tell which is the first sheet, which is the second, etc. (if that is important). gdata has a specific function to do it: library(gdata) sheetNames(myfile.xls) -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at 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] extract worksheet names from an Excel file
Hi list, Is there a R function I can use to extract the worksheet names from an Excel file? If no, any other automatic ways (not using R) to do this? thanks! ...Tao __ 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 worksheet names from an Excel file
Thank you, David and Bill! I'll try that. ...Tao - Original Message - From: David Scott d.sc...@auckland.ac.nz To: bill.venab...@csiro.au Cc: shida...@yahoo.com; r-help@r-project.org Sent: Thursday, June 23, 2011 10:11 PM Subject: Re: [R] extract worksheet names from an Excel file On 24/06/11 16:55, bill.venab...@csiro.au wrote: Package XLConnect appears to provide this kind of thing. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shi, Tao Sent: Friday, 24 June 2011 2:42 PM To: r-help@r-project.org Subject: [R] extract worksheet names from an Excel file Hi list, Is there a R function I can use to extract the worksheet names from an Excel file? If no, any other automatic ways (not using R) to do this? thanks! ...Tao __ 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, reproducible code. If you use RODBC to connect to an xls or xlsx file you can use sqlTables to show not only the worksheet names, but the presence of any named data ranges. Sample code from a student exercise: require(RODBC) channel - odbcConnectExcel(bikesWithDate.xls) sqlTables(channel) David -- _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 __ 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] a bug in heatmap.plus?
Hi Allen and list, See the code below. I've tried it on R2.13 and R2.8.0 using either heatmap.plus 1.3 or the latest. All gave the same results. The problem is in the last line: when I tried to plot two different color bars, the one corresponding to cm.colors(10) is not correct (it starts with one black and one red. Not sure where they're from?) Any ideas? Thanks! ...Tao library(heatmap.plus) set.seed(1234) x - matrix(rnorm(400), ncol=10) heatmap(x, ColSideColors= cm.colors(10), Colv=NA) heatmap.plus(x, ColSideColors=cbind(cm.colors(10), cm.colors(10)), Colv=NA) heatmap.plus(x, ColSideColors=cbind(rep(1:2,each=5), cm.colors(10)), Colv=NA) __ 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] network package in R
Weiwei, I know this is not a Bioconductor-specific question, but you may also want to post it on BiC help list, as there may be more people there understand what you want to do. I'm also curious about the answers to your question. ...Tao - Original Message From: Weiwei Shi helprh...@gmail.com To: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Fri, May 27, 2011 2:32:23 PM Subject: [R] network package in R Hi there, I need a network builder and it can change the node size and color; I am not sure if network package in R can do this or not. The other functions I wanted have been found in that package. BTW, if there is another package in R relating to this, please suggest too. Thanks, Weiwei -- Weiwei Shi, Ph.D Research Scientist Did you always know? No, I did not. But I believed... ---Matrix III [[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-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] changes in coxph in survival from older version?
Thank you very much, Frank and Terry, again, for all your answers! ...Tao - Original Message From: Terry Therneau thern...@mayo.edu To: Shi, Tao shida...@yahoo.com Cc: Frank Harrell f.harr...@vanderbilt.edu; r-help@r-project.org Sent: Fri, May 20, 2011 6:36:28 AM Subject: Re: [R] changes in coxph in survival from older version? On Thu, 2011-05-19 at 17:03 -0700, Shi, Tao wrote: Thank you, Frank and Terry, for all your answers! I'll upgrade my survival package for sure! It seems to me that you two are pointing to two different issues: 1) Is stepwise model selection a good approach (for any data)? 2) Whether the data I have has enough information that even worth to model? For #1, I'm not in a good position to judge and need to read up on it. For #2, I'm still a bit confused about Terry's last comment. If we forget about multivariate model building and just look at variable one by one and select the best predictor (let's say it's highly significant, e.g. p0.0001), the resulting univariate model still can be wrong? What if I use this data as a validation set to validate an existing model? Anything different? Many thanks! Stepwise regression is a bad idea. Whether you let the machine do it or you have a human do it (run all univariates, read the output, pick the best) it is still stepwise selection. It is still very unstable, even with very large sample size. Terry T. __ 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] changes in coxph in survival from older version?
Thank you, Frank and Terry, for all your answers! I'll upgrade my survival package for sure! It seems to me that you two are pointing to two different issues: 1) Is stepwise model selection a good approach (for any data)? 2) Whether the data I have has enough information that even worth to model? For #1, I'm not in a good position to judge and need to read up on it. For #2, I'm still a bit confused about Terry's last comment. If we forget about multivariate model building and just look at variable one by one and select the best predictor (let's say it's highly significant, e.g. p0.0001), the resulting univariate model still can be wrong? What if I use this data as a validation set to validate an existing model? Anything different? Many thanks! ...Tao - Original Message From: Frank Harrell f.harr...@vanderbilt.edu To: r-help@r-project.org Sent: Tue, May 17, 2011 10:51:02 AM Subject: Re: [R] changes in coxph in survival from older version? It's worse if the model does converge because then you don't have a warning about the result being nonsense. Frank Terry Therneau-2 wrote: -- begin included message --- I did realize that there are way more predictors in the model. My initial thinking was use that as an initial model for stepwise model selection. Now I wonder if the model selection result is still valid if the initial model didn't even converge? --- end inclusion --- You have 17 predictors with only 22 events. All methods of variable selection in such a scenario will give essentially random results. There is simply not enough information present to determine a best predictor or best subset of predictors. 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. - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/changes-in-coxph-in-survival-from-older-version-tp3516101p3530024.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. __ 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] changes in coxph in survival from older version?
Hi Terry, Really appreciate your help! Sorry for my late reply. I did realize that there are way more predictors in the model. My initial thinking was use that as an initial model for stepwise model selection. Now I wonder if the model selection result is still valid if the initial model didn't even converge? Thanks! ...Tao - Original Message From: Terry Therneau thern...@mayo.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Thu, May 12, 2011 6:42:09 AM Subject: Re: changes in coxph in survival from older version? On Wed, 2011-05-11 at 16:11 -0700, Shi, Tao wrote: Hi all, I found that the two different versions of survival packages, namely 2.36-5 vs. 2.36-8 or later, give different results for coxph function. Please see below and the data is attached. The second one was done on Linux, but Windows gave the same results. Could you please let me know which one I should trust? Thanks, In your case, neither. Your data set has 22 events and 17 predictors; the rule of thumb for a reliable Cox model is 10-20 events per predictor which implies no more than 2 for your data set. As a result, the coefficients of your model have very wide confidence intervals, the coef for Male for instance has se of 3.26, meaning the CI goes from 1/26 to 26 times the estimate; i.e., there is no biological meaning to the estimate. Nevertheless, why did coxph give a different answer? The later version 2.36-9 failed to converge (20 iterations) with a final log-likelihood of -19.94, the earlier code converges in 10 iterations to -19.91. In version 2.36-6 an extra check was put into the maximizer for coxph in response to an exceptional data set which caused the routine to fail due to overflow of the exp function; the Newton-Raphson iteration algorithm had made a terrible guess in it's iteration path, which can happen with all NR based search methods. I put a limit on the size the linear predictor in the Cox model of 21. The basic argument is that exp(linear-predictor) = relative risk for a subject, and that there is not much biological meaning for risks to be less than exp(-21) ~ 1/(population of the earh). There is more to the reasoning, interested parties should look at the comments in src/coxsafe.c, a 5 line routine with 25 lines of discussion. I will happily accept input the best value for the constant. I never expected to see a data set with both convergence of the LL and linear predictors larger than +-15. Looking at the fit (older code) round(fit2$linear.predictor, 2) [1] 2.26 0.89 4.96 -19.09 -12.10 1.392.82 3.10 [9] 18.57 -25.25 22.94 8.75 5.52 -27.64 14.88 -23.41 [17] 13.70 -28.45 -1.84 10.04 12.62 2.54 6.33 -8.76 [25] 9.684.39 2.92 3.51 6.02 -17.24 5.97 This says that, if the model is to be believed, you have several near immortals in the data set. (Everyone else on earth will perish first). 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.
Re: [R] changes in coxph in survival from older version?
Hi Frank, I know it's kind of beyond the scope of R help, but I would appreciate it if you can elaborate further on this. Are you worrying about this variable selection approach or you think that there is something wrong with the data (it's actually a real dataset)? If it's the first one, I believe I can always narrow down the variables based on univarate analysis and build a multivariate model from that. Many thanks in advance. ...Tao - Original Message From: Frank Harrell f.harr...@vanderbilt.edu To: r-help@r-project.org Sent: Mon, May 16, 2011 11:25:20 AM Subject: Re: [R] changes in coxph in survival from older version? Please don't be serious about doing variable selection with this dataset. Frank Shi, Tao wrote: Hi Terry, Really appreciate your help! Sorry for my late reply. I did realize that there are way more predictors in the model. My initial thinking was use that as an initial model for stepwise model selection. Now I wonder if the model selection result is still valid if the initial model didn't even converge? Thanks! ...Tao - Original Message From: Terry Therneau lt;thern...@mayo.edugt; To: Shi, Tao lt;shida...@yahoo.comgt; Cc: r-help@r-project.org Sent: Thu, May 12, 2011 6:42:09 AM Subject: Re: changes in coxph in survival from older version? On Wed, 2011-05-11 at 16:11 -0700, Shi, Tao wrote: Hi all, I found that the two different versions of survival packages, namely 2.36-5 vs. 2.36-8 or later, give different results for coxph function. Please see below and the data is attached. The second one was done on Linux, but Windows gave the same results. Could you please let me know which one I should trust? Thanks, In your case, neither. Your data set has 22 events and 17 predictors; the rule of thumb for a reliable Cox model is 10-20 events per predictor which implies no more than 2 for your data set. As a result, the coefficients of your model have very wide confidence intervals, the coef for Male for instance has se of 3.26, meaning the CI goes from 1/26 to 26 times the estimate; i.e., there is no biological meaning to the estimate. Nevertheless, why did coxph give a different answer? The later version 2.36-9 failed to converge (20 iterations) with a final log-likelihood of -19.94, the earlier code converges in 10 iterations to -19.91. In version 2.36-6 an extra check was put into the maximizer for coxph in response to an exceptional data set which caused the routine to fail due to overflow of the exp function; the Newton-Raphson iteration algorithm had made a terrible guess in it's iteration path, which can happen with all NR based search methods. I put a limit on the size the linear predictor in the Cox model of 21. The basic argument is that exp(linear-predictor) = relative risk for a subject, and that there is not much biological meaning for risks to be less than exp(-21) ~ 1/(population of the earh). There is more to the reasoning, interested parties should look at the comments in src/coxsafe.c, a 5 line routine with 25 lines of discussion. I will happily accept input the best value for the constant. I never expected to see a data set with both convergence of the LL and linear predictors larger than +-15. Looking at the fit (older code) round(fit2$linear.predictor, 2) [1] 2.26 0.89 4.96 -19.09 -12.10 1.39 2.82 3.10 [9] 18.57 -25.25 22.948.75 5.52 -27.64 14.88 -23.41 [17] 13.70 -28.45 -1.84 10.04 12.62 2.54 6.33 -8.76 [25] 9.684.39 2.923.51 6.02 -17.24 5.97 This says that, if the model is to be believed, you have several near immortals in the data set. (Everyone else on earth will perish first). 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. - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/changes-in-coxph-in-survival-from-older-version-tp3516101p3527017.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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read
Re: [R] R versions for Red Hat Linux
I second Marc on this. I just installed R2.12.2 on my linux box running RHEL. Now I also see R2.13.0 available by typing yum info R. ...Tao - Original Message From: Marc Schwartz marc_schwa...@me.com To: Marta Avalos marta.ava...@isped.u-bordeaux2.fr Cc: r-help@r-project.org Sent: Wed, May 11, 2011 10:08:00 AM Subject: Re: [R] R versions for Red Hat Linux On May 11, 2011, at 10:12 AM, Marta Avalos wrote: Dear all, The latest R version available for Red Hat Linux is 2.10 (from November 2009), whereas the latest version available for Debian, Suse or Ubuntu Linux is 2.13 (from May 2011). Has someone some information about the development/release of new R versions for Red Hat? Thank you in advance, Marta R for RHEL based Linux distributions has been available for some time via the EPEL: http://fedoraproject.org/wiki/EPEL You can review the instructions there for configuring your system to use the EPEL and then use 'yum' to install R: sudo yum install R If by Red Hat, you are actually referring to Fedora, R is available via the regular Fedora repos. Just use the same command line incantation as above. Also, just an FYI that there is a R-SIG-Fedora list, which focused on RH and Fedora specific issues. More info at: https://stat.ethz.ch/mailman/listinfo/r-sig-fedora HTH, Marc Schwartz __ 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, reproducible code.
[R] changes in coxph in survival from older version?
Hi all, I found that the two different versions of survival packages, namely 2.36-5 vs. 2.36-8 or later, give different results for coxph function. Please see below and the data is attached. The second one was done on Linux, but Windows gave the same results. Could you please let me know which one I should trust? Thanks, ...Tao # R2.13.0, survival 2.36-9 = dat=read.csv(tmp1.csv, header=T) fit2 - coxph(Surv(tt, cens) ~., data=dat) Warning message: In fitter(X, Y, strats, offset, init, control, weights = weights, : Ran out of iterations and did not converge summary(fit2) ## the estimates are different . sessionInfo() R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] grDevices datasets splines graphics stats tcltk utils methods base other attached packages: [1] svSocket_0.9-51 TinnR_1.0.3 R2HTML_2.2 Hmisc_3.8-3 survival_2.36-9 loaded via a namespace (and not attached): [1] cluster_1.13.3 grid_2.13.0 lattice_0.19-23 svMisc_0.9-61 tools_2.13.0 # = # R2.12.2, survival 2.36-5 = dat=read.csv(tmp1.csv, header=T) fit2 - coxph(Surv(tt, cens) ~., data=dat) summary(fit2) ## the estimates are different . sessionInfo() R version 2.12.2 (2011-02-25) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] survival_2.36-5 # =__ 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] a bug in write.csv?
As pointed out by Ista, please read the help file. write.csv and write.csv2 provide convenience wrappers for writing CSV files. They set sep, dec and qmethod, and col.names to NA if row.names = TRUE and TRUE otherwise. From: John Kane jrkrid...@yahoo.ca To: r-help r-help@r-project.org; Santosh santosh2...@gmail.com Sent: Fri, April 8, 2011 3:23:40 PM Subject: Re: [R] a bug in write.csv? I believe write.csv had been revamped and some options are no longer available. --- On Fri, 4/8/11, Santosh santosh2...@gmail.com wrote: From: Santosh santosh2...@gmail.com Subject: [R] a bug in write.csv? To: r-help r-help@r-project.org Received: Friday, April 8, 2011, 4:18 PM Dear Rxperts! A simple example where write.csv does not seem to accept user specified arguments.. Why? write.csv(t(1:10),./te1.csv,quo=F,col.names=F) Warning message: In write.csv(t(1:10), ./te1.csv, quo = F, col.names = F) : attempt to set 'col.names' ignored However, write.table does fine.. write.table(t(1:10),./te1.csv,quo=F,col.names=F,sep=,) Would really appreciate your thoughts/suggestions.. [[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-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, reproducible code.
[R] read password-protected files
Hi list, I have a bunch of .csv files that are password-protected. I wonder if there is a way to read them in in R without manually removing the password protection for each file? Thank you very much! ...Tao [[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] How to update R?
This question has been asked by many people already. The easiest way is: 1) install the new version 2) copy all or the libraries that you installed later from the library folder of older version to the new version 3) uninstall the old version 4) do a library update in the new version Done! ...Tao From: Li, Yunfei yunfei...@wsu.edu To: r-help@r-project.org Sent: Thu, March 31, 2011 10:16:23 AM Subject: [R] How to update R? Hi, My R version is old, and I would like to update it. How can I update R and keep all the libraries? Thanks Best, Yunfei Li -- Research Assistant Department of Statistics School of Molecular Biosciences Biotechnology Life Sciences Building 427 Washington State University Pullman, WA 99164-7520 Phone: 509-339-5096 http://www.wsu.edu/~ye_lab/people.html [[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. [[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] How to update R?
Forgot to mention that my way of updating is for Windows only. ...Tao From: Joshua Wiley jwiley.ps...@gmail.com To: Li, Yunfei yunfei...@wsu.edu Cc: r-help@r-project.org Sent: Thu, March 31, 2011 11:05:29 AM Subject: Re: [R] How to update R? Hi Yunfei, It really depends to some extent on the version of R (and your OS) you were using. Here is a link to a blog post that discusses some potential strategies: http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ There are also a number of messages if you search the R-help archive. However, old version of libraries may not be portable to the most recent R, so you may need to update R and update all your libraries too. Cheers, Josh On Thu, Mar 31, 2011 at 10:16 AM, Li, Yunfei yunfei...@wsu.edu wrote: Hi, My R version is old, and I would like to update it. How can I update R and keep all the libraries? Thanks Best, Yunfei Li -- - Research Assistant Department of Statistics School of Molecular Biosciences Biotechnology Life Sciences Building 427 Washington State University Pullman, WA 99164-7520 Phone: 509-339-5096 http://www.wsu.edu/~ye_lab/people.html [[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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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. [[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] read password-protected files
Hi Josh and Prof. Ripley, Thanks for the quick replies! Sorry about the HTML email. It's the default for my yahoo account and forgot to switch. The question was asked by a colleague of mine. After double-checking, yes, they are actually Excel files. Any idea on how to approach this? Thanks! ...Tao From: Prof Brian Ripley rip...@stats.ox.ac.uk Cc: r-help@r-project.org Sent: Thu, March 31, 2011 11:15:35 AM Subject: Re: [R] read password-protected files On Thu, 31 Mar 2011, Shi, Tao wrote: Hi list, I have a bunch of .csv files that are password-protected. I wonder if there is There is nothing in the CSV standard about password protection. I very much doubt that these actually CSV files. So please follow the posting guide [*] a way to read them in in R without manually removing the password protection for each file? [[elided Yahoo spam]] ...Tao [[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. [*] as above: and as you sent HTML you are either full of contempt for the helpeRs or failed to do your homework. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] read password-protected files
Thanks, Josh. I use xlsReadWrite routinely. It would be nice if it has a password option. ...Tao - Original Message From: Joshua Wiley jwiley.ps...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Thu, March 31, 2011 11:50:27 AM Subject: Re: [R] read password-protected files Hi Tao, There are a number of R packages to work with reading/writing Excel files (e.g., xlsReadWrite). If Excel is on the system in question, as long as you have opened the file in Excel, you should be able to use RODBC with RDCOMClient or rcom, but I am not sure those will work if it is password protected unless it is currently unlocked in Excel. HTH, Josh On Thu, Mar 31, 2011 at 11:33 AM, Shi, Tao shida...@yahoo.com wrote: Hi Josh and Prof. Ripley, Thanks for the quick replies! Sorry about the HTML email. It's the default for my yahoo account and forgot to switch. The question was asked by a colleague of mine. After double-checking, yes, they are actually Excel files. Any idea on how to approach this? Thanks! ...Tao From: Prof Brian Ripley rip...@stats.ox.ac.uk To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Thu, March 31, 2011 11:15:35 AM Subject: Re: [R] read password-protected files On Thu, 31 Mar 2011, Shi, Tao wrote: Hi list, I have a bunch of .csv files that are password-protected. I wonder if there is There is nothing in the CSV standard about password protection. I very much doubt that these actually CSV files. So please follow the posting guide [*] a way to read them in in R without manually removing the password protection for each file? Thank you very much! ...Tao [[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. [*] as above: and as you sent HTML you are either full of contempt for the helpeRs or failed to do your homework. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 __ 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] read password-protected files
Thanks, Henrique! I'll try that. ...Tao - Original Message From: Henrique Dallazuanna www...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: Prof Brian Ripley rip...@stats.ox.ac.uk; r-help@r-project.org Sent: Thu, March 31, 2011 12:00:45 PM Subject: Re: [R] read password-protected files Using RDCOMCliente: library(RDCOMClient) eApp - COMCreate(Excel.Application) wk - eApp$Workbooks()$Open(Filename=your_file,Password=your_password) tf - tempfile() wk$Sheets(1)$SaveAs(tf, 3) DF - read.table(sprintf(%s.txt, tf), header = TRUE, sep = \t) On Thu, Mar 31, 2011 at 3:33 PM, Shi, Tao shida...@yahoo.com wrote: Hi Josh and Prof. Ripley, Thanks for the quick replies! Sorry about the HTML email. It's the default for my yahoo account and forgot to switch. The question was asked by a colleague of mine. After double-checking, yes, they are actually Excel files. Any idea on how to approach this? Thanks! ...Tao From: Prof Brian Ripley rip...@stats.ox.ac.uk Cc: r-help@r-project.org Sent: Thu, March 31, 2011 11:15:35 AM Subject: Re: [R] read password-protected files On Thu, 31 Mar 2011, Shi, Tao wrote: Hi list, I have a bunch of .csv files that are password-protected. I wonder if there is There is nothing in the CSV standard about password protection. I very much doubt that these actually CSV files. So please follow the posting guide [*] a way to read them in in R without manually removing the password protection for each file? [[elided Yahoo spam]] ...Tao [[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. [*] as above: and as you sent HTML you are either full of contempt for the helpeRs or failed to do your homework. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] confusion matrix
Hi list, Is there already a function somewhere to output the confusion matrix from two input vectors? table always automatically delete rows or columns with all 0's. For example, I would like the columns for 10 and 30 added back. Thanks! ...Tao 20 40 50 60 70 80 90 100 10 0 0 1 0 0 0 1 0 20 1 2 0 4 0 0 0 1 30 0 0 0 0 0 0 1 1 40 0 0 1 1 2 0 0 0 50 0 1 0 0 0 1 0 0 60 0 0 0 0 0 0 1 1 70 0 0 1 1 1 1 1 1 80 0 1 0 0 0 0 0 1 90 0 0 0 0 0 0 0 3 100 0 0 0 0 1 0 0 3 __ 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] confusion matrix
Thanks, Richard, for your speedy reply! From: Richard M. Heiberger r...@temple.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Tue, March 8, 2011 12:28:05 PM Subject: Re: [R] confusion matrix You need to make your variables into factors and specify the levels. x - c(1,3,4,5) table(x) x 1 3 4 5 1 1 1 1 factor(x) [1] 1 3 4 5 Levels: 1 3 4 5 table(factor(x)) 1 3 4 5 1 1 1 1 table(factor(x, levels=1:5)) 1 2 3 4 5 1 0 1 1 1 Rich On Tue, Mar 8, 2011 at 3:22 PM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there already a function somewhere to output the confusion matrix from two input vectors? table always automatically delete rows or columns with all 0's. For example, I would like the columns for 10 and 30 added back. Thanks! ...Tao 20 40 50 60 70 80 90 100 10 0 0 1 0 0 0 1 0 20 1 2 0 4 0 0 0 1 30 0 0 0 0 0 0 1 1 40 0 0 1 1 2 0 0 0 50 0 1 0 0 0 1 0 0 60 0 0 0 0 0 0 1 1 70 0 0 1 1 1 1 1 1 80 0 1 0 0 0 0 0 1 90 0 0 0 0 0 0 0 3 100 0 0 0 0 1 0 0 3 __ 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. [[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] which functions are being debugged?
Hi Henrique, Thanks for the reply! I posted the question in a hurry yesterday. After a bit research today, I found that back in 2009, Andrew actually asked the same question and there was a good discussion about it: http://r.789695.n4.nabble.com/how-do-you-know-which-functions-are-being-debugged-td906109.html Steve's approach of keeping a record of the debugged functions yourself is more proper, but your function works well for me for now. Thanks! ...Tao From: Henrique Dallazuanna www...@gmail.com Cc: r-help@r-project.org Sent: Wed, February 16, 2011 4:56:01 PM Subject: Re: [R] which functions are being debugged? Try this: isDebug - lapply(sapply(search(), lapply, ls), function(f)sapply(f, function(.f)tryCatch(isdebugged(.f), error = function(...)FALSE))) which(unlist(isDebug)) Hi list, Is there a function that can let me know which functions are being debugged? I know I'm probably not doing a very good job of keeping track of things, but it does get messier when you dig into different layers of a function. I know there is isdebugged, but it only works on one function at a time. Thanks! ...Tao [[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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] which functions are being debugged?
Hi list, Is there a function that can let me know which functions are being debugged? I know I'm probably not doing a very good job of keeping track of things, but it does get messier when you dig into different layers of a function. I know there is isdebugged, but it only works on one function at a time. Thanks! ...Tao [[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] UniCox in R
Hi Samuel, The help file explains which is which: A list with components devcvm Average drop in CV deviance for each lambda value ncallcvm=ncallcvm Average number of features with non-zero wts in the CV, for each lambda value se.devcvm Standard error of average drop in CV deviance for each lambda value devcv Drop in CV deviance for each lambda value ncallcv Number of features with non-zero wts in the CV, for each lambda value folds Indices for CV folds call Call to this function So the following code will do: plot(aa[[2]], aa[[1]], type=b, ylim=c(0,25)) segments(aa[[2]], aa[[1]]-aa[[3]], aa[[2]], aa[[1]]+aa[[3]]) Can't figure out how he made the horizontal bars at the ends of each error bar vary in length. How do you like uniCox? Have seen my previous post regarding the error message? https://stat.ethz.ch/pipermail/r-help/2010-November/260857.html ...Tao To: jim holtman jholt...@gmail.com Cc: r-help@r-project.org Sent: Wed, December 8, 2010 5:59:40 AM Subject: Re: [R] UniCox in R Thank you for your reply. My question was how to create Fig. 2? I am using UniCox; the aa=uniCoxCV gives list of aa$ devcvm aa$ncallcvm aa$se.devcvm, aa$devcv, aa$ ncallcv and aa$ folds, which data I should plot here to create the graph in Fig. 2? Many thanks, Sam --- On Wed, 8/12/10, jim holtman jholt...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] UniCox in R Cc: r-help@r-project.org Date: Wednesday, 8 December, 2010, 5:25 Do a little reading on how to use the graphics commands. I would look at plot lines segments a combination of those will let you easily create the output. It would seem you need some data object that has the dimensions of the bar lengths you want to create, but given that, it is not much of a problem to solve. Hello, I am interested in Figure 2 in http://www-stat.stanford.edu/~tibs/ftp/cus.pdf Can anyone tell please how to create this plot? Many thanks Samuel [[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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? [[alternative HTML version deleted]] [[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] given a sensitivity calculate specificity based on a ROC curve
Hi list, I know this is not hard to implement based on the returned objects from ROC, ROCR or a couple of other roc-related packages. I'm just wondering if there is already such a function exist. Thanks! ...Tao __ 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] question on uniCox
Hi list, I’m testing out uniCox R package (version 1.0, on R2.12.0, WinXP). When I ran uniCox on my data, there are always some NA’s in the beta matrix, which in turn causes problems in uniCoxCV call. I don’t see anything wrong with the corresponding data (e.g. no NAs) and if I fit a univariate Cox model, the features that give NA beta estimates are actually pretty significant. Could you please let me know what happened and how to avoid this? I’ve attached the outputs of the function calls below. Thank you very much! ...Tao a - uniCox(x=t(dat.ave.train.base), y=sampleinfo.ave.train.base$tm2dthr, status=sampleinfo.ave.train.base$censrdth) lambda value 1 out of 20 lambda value 2 out of 20 lambda value 3 out of 20 lambda value 4 out of 20 lambda value 5 out of 20 lambda value 6 out of 20 lambda value 7 out of 20 lambda value 8 out of 20 lambda value 9 out of 20 lambda value 10 out of 20 lambda value 11 out of 20 lambda value 12 out of 20 lambda value 13 out of 20 lambda value 14 out of 20 lambda value 15 out of 20 lambda value 16 out of 20 lambda value 17 out of 20 lambda value 18 out of 20 lambda value 19 out of 20 lambda value 20 out of 20 5 betas missing aa - uniCoxCV(a, x=t(dat.ave.train.base), y=sampleinfo.ave.train.base$tm2dthr, status=sampleinfo.ave.train.base$censrdth) FOLD= 1 lambda value 1 out of 20 lambda value 2 out of 20 lambda value 3 out of 20 lambda value 4 out of 20 lambda value 5 out of 20 lambda value 6 out of 20 lambda value 7 out of 20 lambda value 8 out of 20 lambda value 9 out of 20 lambda value 10 out of 20 lambda value 11 out of 20 lambda value 12 out of 20 lambda value 13 out of 20 lambda value 14 out of 20 lambda value 15 out of 20 lambda value 16 out of 20 lambda value 17 out of 20 lambda value 18 out of 20 lambda value 19 out of 20 lambda value 20 out of 20 3 betas missing 1 Error in coxph(Surv(y[ii], status[ii]) ~ eta.new) : No (non-missing) observations a[[2]][(rowSums(is.na(a[[2]])))0,] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] 92.6641 NaN NaN NaN00000 0 0 0 0 0 0 0 0 0 0 0 [2,] NaN00000000 0 0 0 0 0 0 0 0 0 0 0 [3,] 567.3650 NaN0000000 0 0 0 0 0 0 0 0 0 0 0 __ 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] calculating martingale residual on new data using predict.coxph
Thank you, Terry! - Original Message From: Terry Therneau thern...@mayo.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org; dieter.me...@menne-biomed.de; r_ting...@hotmail.com Sent: Mon, November 22, 2010 6:11:15 AM Subject: Re: calculating martingale residual on new data using predict.coxph This feature has been added in survival 2.36-1, which is now on CRAN. (2.36-2 should appear in another day or so) Terry T. -begin included message I was trying to use predict.coxph to calculate martingale residuals on a test data, however, as pointed out before http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13508.html predict(mycox1, newdata, type=expected) is not implemented yet. __ 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] calculating martingale residual on new data using
Thank you for the advice, Frank! ...Tao - Original Message From: Frank Harrell f.harr...@vanderbilt.edu To: r-help@r-project.org Sent: Sun, November 21, 2010 5:49:36 AM Subject: Re: [R] calculating martingale residual on new data using The tendency is to use residual-like diagnostics on the entire dataset that was available for model development. For test data we typically run predictive accuracy analyses. For example, one of the strongest validations is to show, in a high-resolution calibration plot, that absolute predictions (e.g., probability of survival at 2 years) are accurate. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/calculating-martingale-residual-on-new-data-using-predict-coxph-tp3050712p3052377.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. __ 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] calculating martingale residual on new data using predict.coxph
Thank you, David! You've been always helpful! ...Tao - Original Message From: David Winsemius dwinsem...@comcast.net To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org; dieter.me...@menne-biomed.de; r_ting...@hotmail.com Sent: Sun, November 21, 2010 5:50:31 AM Subject: Re: [R] calculating martingale residual on new data using predict.coxph On Nov 21, 2010, at 3:42 AM, Shi, Tao wrote: Hi David, Thanks, but I don't quite follow your examples below. I wasn't really sure they did anything useful anyway. The residuals you calculated are still based on the training data from which your cox model was generated. I'm interested in the testing data. The survest function in rms and the survfit function in survival will calculate survival probabilities given a model and newdata, and depending on your definition of residual you could take the difference between the calculation and validation data. That must be what happens (at least at a gross level of description) when Harrell runs his validate function on his cph models in the rms/Design package, although I don't know if something that you would recognize as a martingale residual is an identifiable intermediate. If you are using survfit, it would appear from my reading that you would need to set the individual parameter to TRUE. I'm assuming you planned to calculate these (1- expected) at the event times of the validation cohort (which it appears the default method fixes via the censor argument)? --David Best, ...Tao - Original Message From: David Winsemius dwinsem...@comcast.net To: David Winsemius dwinsem...@comcast.net Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org; dieter.me...@menne-biomed.de; r_ting...@hotmail.com Sent: Fri, November 19, 2010 10:53:26 AM Subject: Re: [R] calculating martingale residual on new data using predict.coxph On Nov 19, 2010, at 12:50 PM, David Winsemius wrote: On Nov 19, 2010, at 12:32 PM, Shi, Tao wrote: Hi list, I was trying to use predict.coxph to calculate martingale residuals on a test data, however, as pointed out before What about resid(fit) ? It's my reading of Therneau Gramsch [and of help(coxph.object) ] that they consider those martingale residuals. The manner in which I _thought_ this would work was to insert some dummy cases into the original data and then to get residuals by weighting the cases appropriately. That doesn't seem to be as successful as I imagined: test1 - list(time=c(4,3,1,1,2,2,3,3), weights=c(rep(1,7), 0), + status=c(1,1,1,0,1,1,0,1), + x=c(0,2,1,1,1,0,0,1), + sex=c(0,0,0,0,1,1,1,1)) coxph(Surv(time, status) ~ x , test1, weights=weights)$weights Error in fitter(X, Y, strats, offset, init, control, weights = weights, : Invalid weights, must be 0 # OK then make it a small number test1 - list(time=c(4,3,1,1,2,2,3,3), weights=c(rep(1,7), 0.01), + status=c(1,1,1,0,1,1,0,1), + x=c(0,2,1,1,1,0,0,1), + sex=c(0,0,0,0,1,1,1,1)) print(resid( coxph(Surv(time, status) ~ x , test1,weights=weights) ) ,digits=3) 1 2 3 4 5 6 7 8 -0.6410 -0.5889 0.8456 -0.1544 0.4862 0.6931 -0.6410 0.0509 Now take out constructed case and weights test1 - list(time=c(4,3,1,1,2,2,3), + status=c(1,1,1,0,1,1,0), + x=c(0,2,1,1,1,0,0), + sex=c(0,0,0,0,1,1,1)) print(resid( coxph(Surv(time, status) ~ x , test1) ) ,digits=3) 1 2 3 4 5 6 7 -0.632 -0.589 0.846 -0.154 0.486 0.676 -0.632 Expecting approximately the same residuals for first 7 cases but not really getting it. There must be something about weights in coxph that I don't understand, unless a one-hundreth of a case gets up indexed inside the machinery of coxph? Still think that inserting a single constructed case into a real dataset of sufficient size ought to be able to yield some sort of estimate, and only be a minor perturbation, although I must admit I'm having trouble figuring out ... why are we attempting such a maneuver? The notion of residuals around constructed cases makes me statistically suspicious, although I suppose that is just some sort of cumulative excess/deficit death fraction. http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13508.html predict(mycox1, newdata, type=expected) is not implemented yet. Dieter suggested to use 'cph' and 'predict.Design', but from my reading so far, I'm not sure they can do that. Do you other ways to calculate martingale residuals on a new data? Thank you very much! ...Tao --David
Re: [R] calculating martingale residual on new data using predict.coxph
Hi David, Thanks, but I don't quite follow your examples below. The residuals you calculated are still based on the training data from which your cox model was generated. I'm interested in the testing data. Best, ...Tao - Original Message From: David Winsemius dwinsem...@comcast.net To: David Winsemius dwinsem...@comcast.net Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org; dieter.me...@menne-biomed.de; r_ting...@hotmail.com Sent: Fri, November 19, 2010 10:53:26 AM Subject: Re: [R] calculating martingale residual on new data using predict.coxph On Nov 19, 2010, at 12:50 PM, David Winsemius wrote: On Nov 19, 2010, at 12:32 PM, Shi, Tao wrote: Hi list, I was trying to use predict.coxph to calculate martingale residuals on a test data, however, as pointed out before What about resid(fit) ? It's my reading of Therneau Gramsch [and of help(coxph.object) ] that they consider those martingale residuals. The manner in which I _thought_ this would work was to insert some dummy cases into the original data and then to get residuals by weighting the cases appropriately. That doesn't seem to be as successful as I imagined: test1 - list(time=c(4,3,1,1,2,2,3,3), weights=c(rep(1,7), 0), +status=c(1,1,1,0,1,1,0,1), +x=c(0,2,1,1,1,0,0,1), +sex=c(0,0,0,0,1,1,1,1)) coxph(Surv(time, status) ~ x , test1, weights=weights)$weights Error in fitter(X, Y, strats, offset, init, control, weights = weights, : Invalid weights, must be 0 # OK then make it a small number test1 - list(time=c(4,3,1,1,2,2,3,3), weights=c(rep(1,7), 0.01), +status=c(1,1,1,0,1,1,0,1), +x=c(0,2,1,1,1,0,0,1), +sex=c(0,0,0,0,1,1,1,1)) print(resid( coxph(Surv(time, status) ~ x , test1,weights=weights) ) ,digits=3) 12 3 45 6 78 -0.6410 -0.5889 0.8456 -0.1544 0.4862 0.6931 -0.6410 0.0509 Now take out constructed case and weights test1 - list(time=c(4,3,1,1,2,2,3), +status=c(1,1,1,0,1,1,0), +x=c(0,2,1,1,1,0,0), +sex=c(0,0,0,0,1,1,1)) print(resid( coxph(Surv(time, status) ~ x , test1) ) ,digits=3) 1 2 3 4 5 6 7 -0.632 -0.589 0.846 -0.154 0.486 0.676 -0.632 Expecting approximately the same residuals for first 7 cases but not really getting it. There must be something about weights in coxph that I don't understand, unless a one-hundreth of a case gets up indexed inside the machinery of coxph? Still think that inserting a single constructed case into a real dataset of sufficient size ought to be able to yield some sort of estimate, and only be a minor perturbation, although I must admit I'm having trouble figuring out ... why are we attempting such a maneuver? The notion of residuals around constructed cases makes me statistically suspicious, although I suppose that is just some sort of cumulative excess/deficit death fraction. http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13508.html predict(mycox1, newdata, type=expected) is not implemented yet. Dieter suggested to use 'cph' and 'predict.Design', but from my reading so far, I'm not sure they can do that. Do you other ways to calculate martingale residuals on a new data? Thank you very much! ...Tao --David Winsemius, MD West Hartford, CT __ 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] calculating martingale residual on new data using predict.coxph
Hi list, I was trying to use predict.coxph to calculate martingale residuals on a test data, however, as pointed out before http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13508.html predict(mycox1, newdata, type=expected) is not implemented yet. Dieter suggested to use 'cph' and 'predict.Design', but from my reading so far, I'm not sure they can do that. Do you other ways to calculate martingale residuals on a new data? Thank you very much! ...Tao __ 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] calculating martingale residual on new data using predict.coxph
Hi David, Thank you for the quick reply! resid(fit) only gives the residuals on the training data not on test data. ...Tao - Original Message From: David Winsemius dwinsem...@comcast.net To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org; dieter.me...@menne-biomed.de; r_ting...@hotmail.com Sent: Fri, November 19, 2010 9:50:06 AM Subject: Re: [R] calculating martingale residual on new data using predict.coxph On Nov 19, 2010, at 12:32 PM, Shi, Tao wrote: Hi list, I was trying to use predict.coxph to calculate martingale residuals on a test data, however, as pointed out before What about resid(fit) ? It's my reading of Therneau Gramsch [and of help(coxph.object) ] that they consider those martingale residuals. http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13508.html predict(mycox1, newdata, type=expected) is not implemented yet. Dieter suggested to use 'cph' and 'predict.Design', but from my reading so far, I'm not sure they can do that. Do you other ways to calculate martingale residuals on a new data? Thank you very much! ...Tao David Winsemius, MD West Hartford, CT __ 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] date calculation
Hi Phil, Thanks for the reply, but I don't think you have explained where the decimal part is coming from ...Tao - Original Message - From:Phil Spector spec...@stat.berkeley.edu To:Shi, Tao shida...@yahoo.com Cc:r-h...@stat.math.ethz.ch Sent:Friday, October 29, 2010 5:04:23 PM Subject:Re: [R] date calculation Tao - The documentation for the difftime function says: Function ‘difftime’ calculates a difference of two date/time objects and returns an object of class ‘difftime’ with an attribute indicating the units. So that answers your question. If you want it to be an integer, you're certainly free to make it one: as.integer(difftime(strptime(24NOV2004, format=%d%b%Y), + strptime(13MAY2004,format=%d%b%Y), units=days)) [1] 195 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley ymailto=mailto:spec...@stat.berkeley.edu; href=mailto:spec...@stat.berkeley.edu;spec...@stat.berkeley.edu On Fri, 29 Oct 2010, Shi, Tao wrote: Hi list, Could someone explain to me why the following result is not a integer? difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004, format=%d%b%Y), units=days) Time difference of 195.0417 days I'm using R2.12.0 on WinXP. Thanks! ...Tao __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;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, reproducible code.
Re: [R] date calculation
Hi Ben, That must be the case! In fact if I do: difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004,format=%d%b%Y), units=days, tz=GMT) Time difference of 195 days which supports your claim. Can someone from the R development team confirm this? Thanks! ...Tao - Original Message - From:Ben Bolker bbol...@gmail.com To:r-h...@stat.math.ethz.ch Cc: Sent:Friday, October 29, 2010 7:54:53 PM Subject:Re: [R] date calculation Shi, Tao shidaxia at href=http://yahoo.com;yahoo.com writes: Could someone explain to me why the following result is not a integer? difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004, format=%d%b%Y), units=days) Time difference of 195.0417 days Presumably because this goes across a daylight-savings time adjustment? 0.0417=1/24 days is 1 hour ... Ben Bolker __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] date calculation
Hi Ben and Josh, No, I don't think that there is a bug. It's just due to my lack of knowledge on Date class, I was simply amazed that it has the daylight saving time built in at first. But on the second thought, it really should. Thank you all for the explanations! ...Tao From: Ben Bolker bbol...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Saturday, October 30, 2010 7:22:04 AM Subject: Re: [R] date calculation On 10-10-30 02:02 AM, Shi, Tao wrote: Hi Ben, That must be the case! In fact if I do: difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004,format=%d%b%Y), units=days, tz=GMT) Time difference of 195 days which supports your claim. Can someone from the R development team confirm this? Thanks! ...Tao It sounds like you think this is a bug. It's not (although it's arguably not what you want). The general advice when using dates and time in R is to use the *least* specific date format that will do what you want, i.e. don't use a format that incorporates time zone information (daylight savings time) information if you don't want to deal with these complexities. I would suggest the chron package: library(chron) diff(chron(dates.=c(24/11/2004,13/05/2004),format=d/m/y)) - Original Message - From:Ben Bolker bbol...@gmail.com To:r-h...@stat.math.ethz.ch Cc: Sent:Friday, October 29, 2010 7:54:53 PM Subject:Re: [R] date calculation Shi, Tao shidaxia at href=http://yahoo.com;yahoo.com writes: Could someone explain to me why the following result is not a integer? difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004, format=%d%b%Y), units=days) Time difference of 195.0417 days Presumably because this goes across a daylight-savings time adjustment? 0.0417=1/24 days is 1 hour ... Ben Bolker __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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. [[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] date calculation
I think this demonstrate on of the differences between Class 'Date' and 'POSIXlt'. Thanks, Marc! ...Tao From: Marc Schwartz marc_schwa...@me.com To: Ben Bolker bbol...@gmail.com Cc: Shi, Tao shida...@yahoo.com; r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Saturday, October 30, 2010 7:48:05 AM Subject: Re: [R] date calculation On Oct 30, 2010, at 9:22 AM, Ben Bolker wrote: On 10-10-30 02:02 AM, Shi, Tao wrote: Hi Ben, That must be the case! In fact if I do: difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004,format=%d%b%Y), units=days, tz=GMT) Time difference of 195 days which supports your claim. Can someone from the R development team confirm this? Thanks! ...Tao It sounds like you think this is a bug. It's not (although it's arguably not what you want). The general advice when using dates and time in R is to use the *least* specific date format that will do what you want, i.e. don't use a format that incorporates time zone information (daylight savings time) information if you don't want to deal with these complexities. I would suggest the chron package: library(chron) diff(chron(dates.=c(24/11/2004,13/05/2004),format=d/m/y)) Ben, If time and time zone are not relevant, any reason not to use: diff(as.Date(c(13/05/2004, 24/11/2004), format = %d/%m/%Y)) Time difference of 195 days or perhaps conceptually easier: Date2 - as.Date(24/11/2004, format = %d/%m/%Y) Date1 - as.Date(13/05/2004, format = %d/%m/%Y) Date2 - Date1 Time difference of 195 days R has built in arithmetic operations for such dates, without the need to use another package, since they are effectively numerics with a Date class: str(Date1) Class 'Date' num 12551 str(Date2) Class 'Date' num 12746 ? HTH, Marc Schwartz - Original Message - From:Ben Bolker bbol...@gmail.com To:r-h...@stat.math.ethz.ch Cc: Sent:Friday, October 29, 2010 7:54:53 PM Subject:Re: [R] date calculation Shi, Tao shidaxia at href=http://yahoo.com;yahoo.com writes: Could someone explain to me why the following result is not a integer? difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004, format=%d%b%Y), units=days) Time difference of 195.0417 days Presumably because this goes across a daylight-savings time adjustment? 0.0417=1/24 days is 1 hour ... Ben Bolker [[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] date calculation
Hi list, Could someone explain to me why the following result is not a integer? difftime(strptime(24NOV2004, format=%d%b%Y), strptime(13MAY2004, format=%d%b%Y), units=days) Time difference of 195.0417 days I'm using R2.12.0 on WinXP. Thanks! ...Tao __ 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] pairs with same xlim and ylim scale
Hi Dejian, You're right on this! Do you know how to pass those two argument into lower.panel? Thanks! ...Tao From: Dejian Zhao zha...@ioz.ac.cn To: r-help@r-project.org Sent: Tue, August 31, 2010 6:10:16 PM Subject: Re: [R] pairs with same xlim and ylim scale I think you have successfully passed the xlim and ylim into the function pairs1. Compare the two graphs produced by the codes you provided, you can find the xlim and ylim in the second graph have been reset to the assigned value. It seems that the program halted in producing the second plot after adding xlim and ylim. According to the error message, the two added parameters were not used in lower.panel, or the customized function f.xy. On 2010-9-1 2:26, Shi, Tao wrote: Hi list, I have a function which basically is a wrapper of pairs with some useful panel functions. However, I'm having trouble to pass the xlim and ylim into the function so the x and y axes are in the same scale and 45 degree lines are exactly diagonal. I've looked at some old posts, they didn't help much. I [[elided Yahoo spam]] Thanks! ...Tao pairs1- function(x, ...) { f.xy- function(x, y, ...) { points(x, y, ...) abline(0, 1, col = 2) } panel.cor- function(x, y, digits=2, prefix=, cex.cor) { usr- par(usr); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r- abs(cor(x, y, method=p, use=pairwise.complete.obs)) txt- format(c(r, 0.123456789), digits=digits)[1] txt- paste(prefix, txt, sep=) if(missing(cex.cor)) cex- 0.8/strwidth(txt) text(0.5, 0.5, txt, cex = cex * r) } panel.hist- function(x, ...) { usr- par(usr); on.exit(par(usr)) par(usr = c(usr[1:2], 0, 1.5) ) h- hist(x, plot = FALSE) breaks- h$breaks; nB- length(breaks) y- h$counts; y- y/max(y) rect(breaks[-nB], 0, breaks[-1], y, col=cyan, ...) } pairs(x, lower.panel=f.xy, upper.panel=panel.cor, diag.panel=panel.hist, ...) } x- rnorm(100, sd=0.2) x- cbind(x=x-0.1, y=x+0.1) pairs1(x) pairs1(x, xlim=c(-1,1), ylim=c(-1,1)) Error in lower.panel(...) : unused argument(s) (xlim = c(-1, 1), ylim = c(-1, 1)) [[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-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, reproducible code.
[R] pairs with same xlim and ylim scale
Hi list, I have a function which basically is a wrapper of pairs with some useful panel functions. However, I'm having trouble to pass the xlim and ylim into the function so the x and y axes are in the same scale and 45 degree lines are exactly diagonal. I've looked at some old posts, they didn't help much. I think this is b/c I have multiple panel functions. Help! Thanks! ...Tao pairs1 - function(x, ...) { f.xy - function(x, y, ...) { points(x, y, ...) abline(0, 1, col = 2) } panel.cor - function(x, y, digits=2, prefix=, cex.cor) { usr - par(usr); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r - abs(cor(x, y, method=p, use=pairwise.complete.obs)) txt - format(c(r, 0.123456789), digits=digits)[1] txt - paste(prefix, txt, sep=) if(missing(cex.cor)) cex - 0.8/strwidth(txt) text(0.5, 0.5, txt, cex = cex * r) } panel.hist - function(x, ...) { usr - par(usr); on.exit(par(usr)) par(usr = c(usr[1:2], 0, 1.5) ) h - hist(x, plot = FALSE) breaks - h$breaks; nB - length(breaks) y - h$counts; y - y/max(y) rect(breaks[-nB], 0, breaks[-1], y, col=cyan, ...) } pairs(x, lower.panel=f.xy, upper.panel=panel.cor, diag.panel=panel.hist, ...) } x - rnorm(100, sd=0.2) x - cbind(x=x-0.1, y=x+0.1) pairs1(x) pairs1(x, xlim=c(-1,1), ylim=c(-1,1)) Error in lower.panel(...) : unused argument(s) (xlim = c(-1, 1), ylim = c(-1, 1)) [[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] R eat my data
Changbin, It looks you're trying to read in a gene annotation file and usually it has many strange characters, e.g. #, , (as other people also suggest). I encounter this all the time. So try to be very thorough about your search (the first place I'll look for is the line where R stop reading. See if any thing strange there.) Also, changing read.table to read.delim often works. ...Tao - Original Message From: Changbin Du changb...@gmail.com To: David Winsemius dwinsem...@comcast.net Cc: r-help@r-project.org Sent: Tue, May 25, 2010 9:12:58 AM Subject: Re: [R] R eat my data 644727344ABC-2 type transporterABC-2 type transporter 644727345conserved hypothetical protein conserved hypothetical protein Here is the last two lines of the file id_name_gh5.txt. On Tue, May 25, 2010 at 8:57 AM, David Winsemius href=mailto:dwinsem...@comcast.net;dwinsem...@comcast.netwrote: On May 25, 2010, at 11:42 AM, Changbin Du wrote: HI, Dear R community, My original file has 1932 lines, but when I read into R, it changed to 1068 lines, how comes? We are being asked to investigate this quest, how? Have you looked at the last line to see if it looks like gene_name? Isn't this isomorphic to genetics questions? What sort of mutation is it? Deletion? Abnormal stop codon? Figure out where the transcription process went wrong. This sort of analysis would appear to be right up the alley of someone doing genetics. c...@nuuk:~/operon$ wc -l id_name_gh5.txt 1932 id_name_gh5.txt gene_name-read.table(/home/cdu/operon/id_name_gh5.txt, sep=\t, skip=0, header=F, fill=T) dim(gene_name) [1] 10683 -- David Winsemius, MD West Hartford, CT -- Sincerely, Changbin -- [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] doubt about samr siggenes.table$genes.up
Leo, This question is more suited for the BioC help list. Please post your question over there. Also, offer more info about how you arrived this siggenes.table, what version of R and siggenes package you're using would be helpful. Please read the posting guide! ...Tao - Original Message From: Peter Ehlers ehl...@ucalgary.ca To: Leonardo K shik...@gmail.com Cc: r-help@r-project.org Sent: Tue, May 25, 2010 1:41:36 PM Subject: Re: [R] doubt about samr siggenes.table$genes.up On 2010-05-25 10:54, Leonardo K wrote: Hi, here's my siggenes.table$genes.up snippet. Two class unpaired SAMR analysis. Row Gene ID Gene Name Score(d) Numerator(r) Denominator(s+s0) Fold Change q-value(%) 1 25 RPL15P22 RPL15P22 -1.44115338424578 -18 12.4899959967968 1.27368448239355 0 2 47 CHAF1A CHAF1A -1.44115338424578 -18 12.4899959967968 1.30356683838951 0 3 48 PARP2 PARP2 -1.44115338424578 -18 12.4899959967968 1.09780831177589 0 4 52 HMGXB4 HMGXB4 -1.44115338424578 -18 12.4899959967968 1.22596090318945 0 Why do I get one column more in the data block (9) than the header (8)? Looks like the second column (25,47,48,etc) does not make sense. Presumably you are getting this from an application of write.table? If so, use the argument 'row.names = FALSE' to remove the *first* column. See the first sentence in the 'CSV files' section of ?write.table. Your second column is part of the data you're saving (probably rownames from a larger dataframe or matrix). -Peter Ehlers __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] Fast Matrix Computation
One way to do it: apply(B, 1, function(x) t(apply(A, 1, function(y) abs(y-x) )) ) - Original Message From: David Neu da...@davidneu.com To: r-help@r-project.org Sent: Sat, May 22, 2010 10:35:32 AM Subject: [R] Fast Matrix Computation Hi, I have two (large) matrices A and B of dimensions (m,n) and (p,n) respectively. I'd like to see if the is a fast way to compute a new matrix C with dimension (m*p,n) in which each row in C is found by applying some function f to each pair of rows (x,y) where x is a row in A and y is a row in B. For example, if A - matrix(c(1, 2, 3, 4, 5, 6), byrow=TRUE, ncol=3) B - matrix(c(7, 8, 9), byrow=TRUE, ncol=3) and f - function(x,y) abs(y-x) then C - matrix(c(6, 6, 6, 3, 3, 3), byrow=TRUE, ncol=3) Many thanks! Cheers, David __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] Concatenation
Well, it seems a simple c will do. e.g. df - matrix(rnorm(100), ncol=4) c(t(df[1:10,])) # concatenate rows c(df) # concatenate columns From: santana sarma aimanusa...@gmail.com To: Shi, Tao shida...@yahoo.com; r-help@r-project.org Sent: Thu, May 20, 2010 11:45:25 PM Subject: Re: Concatenation Ok -let's forget about the dataframe. Say, I have this (huge) spreadsheet that has some rows and columns, with unique rownames and column names. Using R, I wish to FINALLY have a spreadsheet where the values of the first 10 rows remain in a single row. And, the values of the next 10 rows remain in the next row and so on. Example: row1 = 2, 3.4, 5, 6 row2 = 3, 4.3, 0, 2 ... row 10 = 1,3, 4, 5 new_row_should_be_like = 2, 3.4, 5, 6, 3, 4.3, 0, 2, .. 1, 3, 4, 5 Similarly, Similarly, for columns, the new spreadsheet should FINALLY contain : the values of the columns coming one below the other (i.e., resulting in a single column, without the identifiers). col1 col2 col3. col10 2 3 45 1 2 50 ... ... new_column_should_be_like = 2 1 ... 3 2 4 5 ... 5 0 . .. Cheers, = = = === = = = = = On Fri, May 21, 2010 at 5:51 PM, Shi, Tao shida...@yahoo.com wrote: Still not clear. Follow the posting guide and some examples always help. Not sure how you concatenate numbers? You can try, for example, apply(df[1:10,], 2, paste, collapse= ) but this will turn everything into strings. Is this what you want? ..Tao - Original Message From: santana sarma aimanusa...@gmail.com To: David Winsemius dwinsem...@comcast.net Cc: r-help@r-project.org Sent: Thu, May 20, 2010 9:21:33 PM Subject: Re: [R] Concatenation Hi David, SORRY - I am trying to be more clearer this time. Let's say the dataframe has some rows and columns, with unique rownames and column names. The rest of the data in the dataframe are just numbers. I wish to concatenate those rows. That means : I wish to concatenate first 10 rows' values in one row, then next 20 rows's values in the next row and so on. Similarly, for columns : The first 10 column's values will be one below the other ... and so on. Cheers, = = = = = = = = = = = On Fri, May 21, 2010 at 3:53 PM, David Winsemius ymailto=mailto:dwinsem...@comcast.net; href=mailto:dwinsem...@comcast.net;dwinsem...@comcast.netwrote: On May 20, 2010, at 11:05 PM, santana sarma wrote: Hi, I have a dataframe with some 800 rows and 14 columns. Could you please advise how I can concatenate the rows - one after another. Similarly for columns, one below the other. Not sure exactly what you are after: unlist might accomplish the second task. Whether c(apply(df, 1, I)) would be satisfactory for the first task might depend on whether the columns in the dataframe were all of the same type. Now that I think of it, both soolutions would force the types to be that same. ?c ?I ?apply df[1:nrow(df), ] ... would essentially give you the first request, but it would not be any different than just typing df. So what do intend this process to accomplish? -- David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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. [[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] p-values 2.2e-16 not reported
Will, I'm wondering if you have any insights after looking at the cor.test source code. It seems to be fine to me, as the p value is either calculated by your first method or a .C code. ...Tao - Original Message From: Will Eagle will.ea...@gmx.net To: r-help@r-project.org Sent: Wed, May 19, 2010 3:31:26 PM Subject: Re: [R] p-values 2.2e-16 not reported Dear all, thanks for your feedback so far. With the help of a colleague I think I found the solution to my problem: pt(10,100,lower=FALSE) [1] 4.950844e-17 IS *NOT* EQUAL TO 1-pt(10,100,lower=TRUE) [1] 0 This means that R is capable of providing p-values 2.2e-16, however, if the value is used in a substraction or addition then the default value of the machine epsilon .Machine$double.eps = 2.220446e-16 is applied. This causes that all p-values smaller than this threshold are set to zero. This problem applies also to other distribution functions like pnorm() and others. For your information I would also like to quote the relevant part of the R manual on .Machine$double.eps: the smallest positive floating-point number x such that 1 + x != 1. It equals base^ulp.digits if either base is 2 or rounding is 0; otherwise, it is (base^ulp.digits)/ 2. Normally 2.220446e-16. Although different opinions were expressed on whether it makes sense to differentiate p-values below the machine epsilon, in my opinion different effect sizes should correspond with different p-values when reporting statistical results. Additionally, in certain scientific fields, eg genetics, where usually many tests are performed and simple methods, eg Bonferroni method, are used to adjust for multiple testing, it is important to know the exact size of the p-value. Therefore, I would like to suggest that operations of the 2nd variant (ie 1-pt(10,100,lower=TRUE)) should be deprecated to calculate p-values and operations of the 1st variant (ie pt(10,100,lower=FALSE)) should be used instead. Since I have seen the 2nd variant being frequently used (also by very experienced R users) and I assume that it is hidden in many statistical test functions, eg cor.test(), this issue seems to me quite important. Best regards, Will __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] About the breakpoint when making heatmap with lots of variables
The breakpoint you mentioned is irrelevant here. Clustering 15672 genes (I assume this is a microarray data) requires lots of memory. I suggest you either filter your gene list down to thousands or just plot the column dendrogram without showing the heatmap. plot(hclust(dist(x))) ...Tao - Original Message From: Meng Wu mengwu1...@gmail.com To: r-help@r-project.org Sent: Wed, May 19, 2010 7:31:29 PM Subject: [R] About the breakpoint when making heatmap with lots of variables HI,All I am trying to create a heatmap with 24 samples with 15672 varibles, I read in the table in R, and then made it as a matrix, then try to create the heatmap using heatmap(x,...) However, I received the error message as: heatmap(t(x)) Error: cannot allocate vector of size 936.8 Mb R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(2925,0xa0b16500) malloc: *** mmap(size=982261760) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug It seems like I do not have enough memory, how can I set a breakpoint as suggested? Thanks, Meng [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] colored venn diagram
Thank you for the suggestions, Peter and David! - Original Message From: Peter Ehlers ehl...@ucalgary.ca To: David Winsemius dwinsem...@comcast.net Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org Sent: Wed, May 19, 2010 8:45:24 PM Subject: Re: [R] colored venn diagram Tao, You might also have a look at the venneuler package. -Peter Ehlers On 2010-05-19 21:37, David Winsemius wrote: On May 19, 2010, at 7:15 PM, Shi, Tao wrote: Hi list, This is probably too much to ask, but I'm wondering if there is a ready-to-use function somewhere that allows me to color one area of a venn diagram (e.g. the intersection of two sets)? There is an intersectDiagrapm in plotrix that accepts color arguments, although it is not really a Venn diagram. The venn function in gplots does not accept color. It is a wrapper to getVennCounts and drawVennDiagram, and if you hack the second function you can get colors. For the example in the help page for Venn, you need to find the section that handles the correct number of sets and add a color argument to the polygon call. If you want intersections you will need transparency. I do not know how to address specific subsets: require(gplots) require(seqinr) # for col2alpha for transparency getAnywhere(drawVennDiagram) # add an assignment operator and trim out this stuff A single object matching ‘drawVennDiagram’ was found It was found in the following places namespace:gplots with value --end trimming-- function (data, small = 0.7, showSetLogicLabel = FALSE, simplify = FALSE) { numCircles - NA . . # make mod to n==4 section + polygon(relocate_elp(elps, 45, 130, 170), col=col2alpha(red, 0.5) ) + polygon(relocate_elp(elps, 45, 200, 200), col=col2alpha(blue, 0.5) ) + polygon(relocate_elp(elps, 135, 200, 200)) + polygon(relocate_elp(elps, 135, 270, 170)) . . ... And then pass the result from venn to drawVennDiagram: gv - venn(input) drawVennDiagram(data = gv, small = 0.7, showSetLogicLabel = FALSE, simplify = FALSE) Set #1 in pink set2 in blue and the intersection is purple. __ 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] Concatenation
Still not clear. Follow the posting guide and some examples always help. Not sure how you concatenate numbers? You can try, for example, apply(df[1:10,], 2, paste, collapse= ) but this will turn everything into strings. Is this what you want? ..Tao - Original Message From: santana sarma aimanusa...@gmail.com To: David Winsemius dwinsem...@comcast.net Cc: r-help@r-project.org Sent: Thu, May 20, 2010 9:21:33 PM Subject: Re: [R] Concatenation Hi David, SORRY - I am trying to be more clearer this time. Let's say the dataframe has some rows and columns, with unique rownames and column names. The rest of the data in the dataframe are just numbers. I wish to concatenate those rows. That means : I wish to concatenate first 10 rows' values in one row, then next 20 rows's values in the next row and so on. Similarly, for columns : The first 10 column's values will be one below the other ... and so on. Cheers, = = = = = = = = = = = On Fri, May 21, 2010 at 3:53 PM, David Winsemius ymailto=mailto:dwinsem...@comcast.net; href=mailto:dwinsem...@comcast.net;dwinsem...@comcast.netwrote: On May 20, 2010, at 11:05 PM, santana sarma wrote: Hi, I have a dataframe with some 800 rows and 14 columns. Could you please advise how I can concatenate the rows - one after another. Similarly for columns, one below the other. Not sure exactly what you are after: unlist might accomplish the second task. Whether c(apply(df, 1, I)) would be satisfactory for the first task might depend on whether the columns in the dataframe were all of the same type. Now that I think of it, both soolutions would force the types to be that same. ?c ?I ?apply df[1:nrow(df), ] ... would essentially give you the first request, but it would not be any different than just typing df. So what do intend this process to accomplish? -- David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] save in for loop
Ivan, Try this: eval(parse(text=paste(save(file, i, , file=\file, i, .RData\), sep=))) ...Tao - Original Message From: Ivan Calandra ivan.calan...@uni-hamburg.de To: r-help@r-project.org Sent: Wed, May 19, 2010 7:56:44 AM Subject: [R] save in for loop Dear users, My problem concerns save() within a for loop. Here is my code: for (i in 1:4) { temp - data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)]) filename - paste(file, i, sep=) assign(filename, temp) save(filename, file=paste(filename, .rda, sep=)) } As you can see, save() doesn't work as I would like: (1) the object saved is called filename (instead of file1, file2, etc), and (2) it of course contains only the name (as character) instead of the data.frame How can I fix it? I usually use lists for such cases, but (1) in the real thing, it gets complicated with the names and structure (because I want to save lists with 3 dimensions instead of simple data.frames, as in this example) and (2) I prefer saving each list separately (and I cannot save only one element of an object either). I'm not sure I'm really clear because it's difficult for me to explain it, but I hope you'll understand (and let me know what you would help you to understand) Thank you in advance Ivan -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 href=mailto:ivan.calan...@uni-hamburg.de;ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
[R] colored venn diagram
Hi list, This is probably too much to ask, but I'm wondering if there is a ready-to-use function somewhere that allows me to color one area of a venn diagram (e.g. the intersection of two sets)? Thanks! ...Tao __ 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] automate curve drawing on nls() object
I can't directly answer your question regarding 'expression', but can you just replace b, c,d, and e with coef(obj)[1], coef(obj)[2], ... etc. You still can automate the whole process this way, right? - Original Message From: array chip arrayprof...@yahoo.com To: r-help@r-project.org Sent: Tue, May 18, 2010 4:13:33 PM Subject: [R] automate curve drawing on nls() object Hi, I would like to use the curve() function to draw the predicted curve from an nls() object. for example: dd-read.table(dd.txt,sep='\t',header=T,row.names=1) obj-nls(y~c+(d-c)/(1+(x/e)^b),data=dd,start=list(b=-1, c=0, d=100, e=150)) coef(obj) b c d e -1.1416422 0.6987028 102.8613176 135.9373131 curve(0.699+(102.86-0.699)/(1+(x/135.94)^(-1.1416)),1,2) Now I am going to have a lot of datasets to do this, so certainly I would like to automate this. Suppose that I can create a character string for the formula, but I am not sure how to pass that character string into the curve() to make it work. The help page of curve() says the first argument is an expression written as a function of x, or alternatively the name of a function which will be plotted. I tried the following, for example: substitute(expression(c + (d - c)/(1 + (x/e)^b)),as.list(coef(obj))) will return: expression(0.698704171233635 + (102.861317499063 - 0.698704171233635)/(1 + (x/135.937317917920)^-1.14164217993857)) so I tried: curve(substitute(expression(c + (d - c)/(1 + (x/e)^b)), as.list(coef(obj))), 1,2) but it returns an error: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ Any suggestions? A related question: If I do this: substitute(expression(c + (d - c)/(1 + (x/e)^b)),as.list(coef(obj))) I will get: expression(0.698704171233635 + (102.861317499063 - 0.698704171233635)/(1 + (x/135.937317917920)^-1.14164217993857)) But if I do: substitute(parse(text=as.character(obj$call$formula[3]),srcfile=NULL),as.list(coef(obj))) I only get: parse(text = as.character(obj$call$formula[3]), srcfile = NULL) as a result, not have b,c,d,e replaced by coefficient values. where parse(text=as.character(obj$call$formula[3]),srcfile=NULL) returns the wanted expression: expression(c + (d - c)/(1 + (x/e)^b)) Why is that? Thanks John __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] automate curve drawing on nls() object
In this case, Ben's approach is the way to go. I'm curious how you fit nls without knowing the model formula beforehand? ...Tao - Original Message From: array chip arrayprof...@yahoo.com To: r-help@r-project.org; TaoShi shida...@yahoo.com Sent: Tue, May 18, 2010 5:22:47 PM Subject: Re: [R] automate curve drawing on nls() object well, this is not going automate enough because you have to know how the model (formula) looks like, and how many parameters there are in the model beforehand to do what you are suggesting. Thanks --- On Tue, 5/18/10, Shi, Tao href=mailto:shida...@yahoo.com;shida...@yahoo.com wrote: From: Shi, Tao href=mailto:shida...@yahoo.com;shida...@yahoo.com Subject: Re: [R] automate curve drawing on nls() object To: array chip ymailto=mailto:arrayprof...@yahoo.com; href=mailto:arrayprof...@yahoo.com;arrayprof...@yahoo.com, ymailto=mailto:r-help@r-project.org; href=mailto:r-help@r-project.org;r-help@r-project.org Date: Tuesday, May 18, 2010, 7:42 PM I can't directly answer your question regarding 'expression', but can you just replace b, c,d, and e with coef(obj)[1], coef(obj)[2], ... etc. You still can automate the whole process this way, right? - Original Message From: array chip href=mailto:arrayprof...@yahoo.com;arrayprof...@yahoo.com To: href=mailto:r-help@r-project.org;r-help@r-project.org Sent: Tue, May 18, 2010 4:13:33 PM Subject: [R] automate curve drawing on nls() object Hi, I would like to use the curve() function to draw the predicted curve from an nls() object. for example: dd-read.table(dd.txt,sep='\t',header=T,row.names=1) obj-nls(y~c+(d-c)/(1+(x/e)^b),data=dd,start=list(b=-1, c=0, d=100, e=150)) coef(obj) b c d e -1.1416422 0.6987028 102.8613176 135.9373131 curve(0.699+(102.86-0.699)/(1+(x/135.94)^(-1.1416)),1,2) Now I am going to have a lot of datasets to do this, so certainly I would like to automate this. Suppose that I can create a character string for the formula, but I am not sure how to pass that character string into the curve() to make it work. The help page of curve() says the first argument is an expression written as a function of x, or alternatively the name of a function which will be plotted. I tried the following, for example: substitute(expression(c + (d - c)/(1 + (x/e)^b)),as.list(coef(obj))) will return: expression(0.698704171233635 + (102.861317499063 - 0.698704171233635)/(1 + (x/135.937317917920)^-1.14164217993857)) so I tried: curve(substitute(expression(c + (d - c)/(1 + (x/e)^b)), as.list(coef(obj))), 1,2) but it returns an error: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ Any suggestions? A related question: If I do this: substitute(expression(c + (d - c)/(1 + (x/e)^b)),as.list(coef(obj))) I will get: expression(0.698704171233635 + (102.861317499063 - 0.698704171233635)/(1 + (x/135.937317917920)^-1.14164217993857)) But if I do: substitute(parse(text=as.character(obj$call$formula[3]),srcfile=NULL),as.list(coef(obj))) I only get: parse(text = as.character(obj$call$formula[3]), srcfile = NULL) as a result, not have b,c,d,e replaced by coefficient values. where parse(text=as.character(obj$call$formula[3]),srcfile=NULL) returns the wanted expression: expression(c + (d - c)/(1 + (x/e)^b)) Why is that? Thanks John __ ymailto=mailto: href=mailto:R-help@r-project.org;R-help@r-project.org href=mailto: href=mailto:R-help@r-project.org;R-help@r-project.org ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href= href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank target=_blank 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, reproducible code.
Re: [R] SAS for R-users
Thomas, If you're thinking to leverage your R programming skill in learning SAS, you'll be disappointed, as the two have quite different grammar. The book Erik mentioned is a good start. After that, just reading the SAS help file, which is pretty comprehensive, will keep you busy. ...Tao - Original Message From: Erik Iverson er...@ccbr.umn.edu To: Thomas Levine thomas.lev...@gmail.com Cc: r-help@r-project.org Sent: Fri, May 14, 2010 6:18:04 AM Subject: Re: [R] SAS for R-users Thomas Levine wrote: There are loads of resources for users of any other statistics package who are learning R. For example http://www.google.com/search?q=r+for+sas-users; The reverse isn't the case href=http://www.google.com/search?q=; target=_blank http://www.google.com/search?q=sas+for+r-users; snip I can't wait that long. Until then and until I can convince colleagues and teachers to use better software, how do you suggest that I learn SAS? I suspect that it'll be a book on R for SAS-users, so I'm expecting recommendations of books like those that are best for R-users learning SAS. This question would be more appropriate for a SAS mailing list, I couldn't find any except for those of a few regional groups. I don't think there is any shortage of SAS books, since it's been around so long. I think they even have their own Press. The books don't need to assume you do or don't know R. If you know nothing of SAS, I personally recommend The Little SAS Book: A Primer. It's short, basic, and useful for beginners. __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
[R] rpart: how to use each variable only once?
Hi list, Is there a way in rpart to force the variables only used once when doing the splits? This is how the question came about. Often time, the tree constructed uses the same variable (say X1) for the first and second splits, for example. However, due to practical reason, the researcher doesn't like this. The prefer to see the second split using other variables (say X2). Therefore the question. I understand the performance will suffer. However if there is a performance improvement for the tree with X1 as 1st split and X2 as 2nd split comparing the tree with one single split using X1, I guess it's still a reasonable thing to do, right? Many thanks! ...Tao __ 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] Multiple plots; single x(y) labels
Gurmeet, I think Xin is more interested in the common axes, rather than just one single xlab or ylab. Jim's solution is much more fancier than mine :-) ...Tao - Original Message From: Gurmeet r.emailing.l...@gmail.com To: Jim Lemon j...@bitwrit.com.au Cc: r-help@r-project.org Sent: Fri, May 14, 2010 10:00:03 AM Subject: Re: [R] Multiple plots; single x(y) labels Hi Xin, Or, just try adding oma and mtext commands: ?par ?mtext # Code par(mfcol=c(2,2)) par(oma=c(2,2,0,0)) plot(x - sort(rnorm(7)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(27)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(47)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(67)), type = s, main = , ylab=, xlab=) mtext(One x-label, side = 1, outer=TRUE) mtext(One y-label, side = 2, outer=TRUE) ~Gurmeet On Fri, May 14, 2010 at 4:14 AM, Jim Lemon href=mailto:j...@bitwrit.com.au;j...@bitwrit.com.au wrote: On 05/14/2010 02:04 AM, Xin Ge wrote: Hi All, Can anyone please help me with getting a single x and y-axis label while plotting muliple plots. Here is the code: par(mfcol=c(2,2)) plot(x- sort(rnorm(7)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(27)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(47)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(67)), type = s, main = , ylab=, xlab=) also, how can remove x-tick lables using plot()? Hi Xin, Fortunately, this wheel is pretty easy to reinvent: require(plotrix) x1-rnorm(7) x2-rnorm(27) x3-rnorm(47) x4-rnorm(67) allxlim-c(1,67) allylim-range(c(x1,x2,x3,x4)) panes(matrix(1:4,nrow=2,byrow=TRUE),widths=c(1.1,1), heights=c(1,1.1)) par(mar=c(0,4,2,0)) plot(sort(x1),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,xaxt=n) tab.title(Plot of x1,tab.col=orange) par(mar=c(0,0,2,1)) plot(sort(x2),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,xaxt=n,yaxt=n) tab.title(Plot of x2,tab.col=orange) par(mar=c(4,4,2,0)) plot(sort(x3),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=) tab.title(Plot of x3,tab.col=orange) par(mar=c(4,0,2,1)) plot(sort(x4),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,yaxt=n) tab.title(Plot of x4,tab.col=orange) Jim __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;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. [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] Putting 6 graphs on one page
Without the actual data, it's hard to see what's going on here, but It seems you have to restructure your data object to a long table, then it should be easy to use 'dotplot' to generate your plots. ...Tao - Original Message From: Dimitri Liakhovitski dimitri.liakhovit...@gmail.com To: r-help@r-project.org Sent: Fri, May 14, 2010 10:19:38 AM Subject: [R] Putting 6 graphs on one page Apologies, if it's a very simple question, but I am really not very good with trellis. I have a piece of a code (below) that works just fine and builds 6 graphs - in a loop. I loop through 6 conditions and build one graph for each. What would be the most efficient way of creating one page with 6 graphs instead? (2 rows and 3 columns)? Thanks a lot! Dimitri conditions-c(a,b,c,d,e,f) conditions.long-c(It's a,It's b,It's c,It's d,It's e,It's f) for(i in 1:6) { IV-conditions[i] filename2=paste(DependentVariable ,IV ,IV,.emf,sep=) win.metafile(file=filename2) out-as.data.frame(tapply(data$DependentVariable.j,data[[IV]],mean)) out$IV-as.factor(as.numeric(row.names(out))) names(out)[1]-j out2-as.data.frame(tapply(data$DependentVariable,data[[IV]],mean)) out-cbind(out,out2) names(out)[3]-rf par.settings=trellis.par.set(superpose.line = list(col=c(PrimaryColors[4],SecondaryColors[4]),lwd = 2,lty=c(1,3)), superpose.symbol = list(cex = 1.5, pch = c(1,3), lty=c(1,3),col=c(PrimaryColors[4],SecondaryColors[4])), reference.line = list(col = gray, lty =dotted)) plot-dotplot(c(out$j,out$rf)~rep(out$IV,2), groups=rep(c(Method1,Method1), each=nrow(out)), type=b, scales=list(x=list(cex=1.3),y=list(cex=1.3)), auto.key = list(space = top, points = TRUE, lines = TRUE,cex=1.3), ylim=c(0,5), xlab=list(conditions.long[i],cex=1.2,font=2), ylab=list(Dependent Variable,cex=1.2,font=2), cex.lab=1.5, panel = function(y,x,...) { panel.grid(h = -1, v = -1) panel.xyplot(x, y, ...) ltext(x, y, labels=round(y,2), cex=1.3,col=black,font=1,pos=3) }) print(plot) dev.off() } -- Dimitri Liakhovitski Ninah Consulting target=_blank href=http://www.ninah.com;www.ninah.com __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] Multiple plots; single x(y) labels
ha, I was focusing on the wrong thing! Sorry, Gurmeet. Good job! From: Xin Ge xingemaill...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: Gurmeet r.emailing.l...@gmail.com; Jim Lemon j...@bitwrit.com.au; r-help@r-project.org Sent: Fri, May 14, 2010 10:51:26 AM Subject: Re: [R] Multiple plots; single x(y) labels Thank you all for your replies. @Tao: Actually Gurmeet's solution is the one I was looking for, below is a chunk from my last email: * Like for example, the following plot has a *combine* x-label (Height) and one y-label (Weight) http://support.sas.com/documentation/cdl/en/grstateditug/61951/HTML/default/images/multi-panel-data.gif * In the process I learnt so many other stuff, ~Xin On Fri, May 14, 2010 at 1:29 PM, Shi, Tao shida...@yahoo.com wrote: Gurmeet, I think Xin is more interested in the common axes, rather than just one single xlab or ylab. Jim's solution is much more fancier than mine :-) ...Tao - Original Message From: Gurmeet r.emailing.l...@gmail.com To: Jim Lemon j...@bitwrit.com.au Cc: r-help@r-project.org Sent: Fri, May 14, 2010 10:00:03 AM Subject: Re: [R] Multiple plots; single x(y) labels Hi Xin, Or, just try adding oma and mtext commands: ?par ?mtext # Code par(mfcol=c(2,2)) par(oma=c(2,2,0,0)) plot(x - sort(rnorm(7)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(27)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(47)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(67)), type = s, main = , ylab=, xlab=) mtext(One x-label, side = 1, outer=TRUE) mtext(One y-label, side = 2, outer=TRUE) ~Gurmeet On Fri, May 14, 2010 at 4:14 AM, Jim Lemon href=mailto:j...@bitwrit.com.au;j...@bitwrit.com.au wrote: On 05/14/2010 02:04 AM, Xin Ge wrote: Hi All, Can anyone please help me with getting a single x and y-axis label while plotting muliple plots. Here is the code: par(mfcol=c(2,2)) plot(x- sort(rnorm(7)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(27)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(47)), type = s, main = , ylab=, xlab=) plot(x- sort(rnorm(67)), type = s, main = , ylab=, xlab=) also, how can remove x-tick lables using plot()? Hi Xin, Fortunately, this wheel is pretty easy to reinvent: require(plotrix) x1-rnorm(7) x2-rnorm(27) x3-rnorm(47) x4-rnorm(67) allxlim-c(1,67) allylim-range(c(x1,x2,x3,x4)) panes(matrix(1:4,nrow=2,byrow=TRUE),widths=c(1.1,1), heights=c(1,1.1)) par(mar=c(0,4,2,0)) plot(sort(x1),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,xaxt=n) tab.title(Plot of x1,tab.col=orange) par(mar=c(0,0,2,1)) plot(sort(x2),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,xaxt=n,yaxt=n) tab.title(Plot of x2,tab.col=orange) par(mar=c(4,4,2,0)) plot(sort(x3),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=) tab.title(Plot of x3,tab.col=orange) par(mar=c(4,0,2,1)) plot(sort(x4),xlim=allxlim,ylim=allylim,type=s, main=,ylab=,xlab=,yaxt=n) tab.title(Plot of x4,tab.col=orange) Jim __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;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. [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code. [[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] rpart: how to use each variable only once?
This is just one single decision tree, not forest. If you're asking what package I use to construct one single tree, it's 'rpart'. From: Changbin Du changb...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Fri, May 14, 2010 12:35:20 PM Subject: Re: [R] rpart: how to use each variable only once? is this random decision tree, I dont know is there any package can run it. If you know, please let me know. On Fri, May 14, 2010 at 10:23 AM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a way in rpart to force the variables only used once when doing the splits? This is how the question came about. Often time, the tree constructed uses the same variable (say X1) for the first and second splits, for example. However, due to practical reason, the researcher doesn't like this. The prefer to see the second split using other variables (say X2). Therefore the question. I understand the performance will suffer. However if there is a performance improvement for the tree with X1 as 1st split and X2 as 2nd split comparing the tree with one single split using X1, I guess it's still a reasonable thing to do, right? Many thanks! ...Tao __ 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. -- Sincerely, Changbin -- [[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] Whiskers on the default boxplot {graphics}
Hi Robert, Your points are well taken. However, I reserve mine, b/c I think without this detailed discussion, an average R user would simply confused the interquartile range said in boxplot help file with the results of IQR. Changing it to length of box makes it more exact and consistent, as I stated earlier. With all these being said, this is up to the R core team to decide. ...Tao - Original Message From: Robert Baer rb...@atsu.edu To: Shi, Tao shida...@yahoo.com; Peter Ehlers ehl...@ucalgary.ca Cc: R Project Help R-help@r-project.org Sent: Thu, May 13, 2010 7:25:09 AM Subject: Re: [R] Whiskers on the default boxplot {graphics} Hi Peter, You're absolutely correct! The description for 'range' in 'boxplot' help file is a little bit confusing by using the words interquartile range. I think it should be changed to the length of the box to be exact and consistent with those in the help file for boxplot.stats. The issue is probably that there are multiple ways (9 to be exact) of defining quantiles in R. See 'type= ' arguement for ?quantile. The quantile function uses type=7 by default which matches the quantile definition used by S-Plus(?), but differs from that used by SPSS. Doesn't fivenum essentially use the equivalent of a different type= arguement (maybe 2 or 5) in constructing the hinges? It seems perfectly reasonable to talk about 'length of box' (or 'box height' depending how you display the boxplot), but aren't the hinges simply Q1 and Q3 defined by one of the possible quartile definitions (as Peter points out the one used by fivenum)? The box height does not necesarily match the distance produced by IQR() which also seems to use the equivalent of quantile(..., type=7), but it is still an IQR, is it not? Quantiles apparantly can be defined in more than one acceptable way (sort of like dealing with ties in rank statistics). The OP seemed to want an exact explanation of the wiskers, and I think Peter has pointed us at the definition of quartiles used by fivenum, as opposed to the default used with quantile(..., type=7). All that said, I'm not convinced that it is wrong to speak of interquartile range in 'boxplot' help. Rob __ 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] a question about latex in Hmisc
Hi Duncan, I have no problems running latex or pdflatex. I re-ran my code and it seems the problem is that R (or MiKTex ?) put the .tex file (the one wrapping everything in a document format for displaying purpose) in a R tmp folder, but the corresponding .log, .aux, and .dvi in my working directory. So when YAP was called, it was looking for the .dvi file in the R temp folder. Therefore, the error window. http://i41.tinypic.com/15qz387.jpg I wonder how to fix that? Thanks! ...Tao - Original Message From: Duncan Murdoch murdoch.dun...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: Ista Zahn istaz...@gmail.com; r-help@r-project.org Sent: Wed, May 12, 2010 1:40:50 PM Subject: Re: [R] a question about latex in Hmisc On 12/05/2010 4:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the tmp - latex(x) method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. latex(x) returns an object of class latex. When you don't assign it, it prints. The print method for latex objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file). If you can't run latex, you can't print those objects. That's why you're getting an error. Duncan Murdoch __ 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] a question about latex in Hmisc
Hi Prof. Harrell, Originally, I was thinking that by putting tables (especially those long tables) into separate .tex files would make my 'big' .tex file more organized (i.e. rather than having an one giant .tex file). But now I'm having a second thought, b/c I don't really have to worry how my 'big' .tex file looks, as it's just a intermediate and I'll do all my editing in the .Rnw file. So, I think I'll use the latex(x, file=) method more. This also will make my working directory cleaner. Thank you very much! ...Tao - Original Message From: Frank E Harrell Jr f.harr...@vanderbilt.edu To: r-help@r-project.org Sent: Wed, May 12, 2010 4:28:20 PM Subject: Re: [R] a question about latex in Hmisc On 05/12/2010 03:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the tmp- latex(x) method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. ...Tao Not clear why the earlier suggestion someone made to use latex(object, file='') is not the method of choice with Sweave. Frank = If you would rather have a separate file for your table you can continue to use your original method, e.g., = tmp- latex(x, file=x.tex) @ \include{x.tex} (not sure what your objection to this was in the first place). -Ista -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] Path to R script
In this case, deploy them as a R package is the way to go. - Original Message From: Johannes W. Dietrich j.w.dietr...@medizinische-kybernetik.de To: Shi, Tao shida...@yahoo.com; johannes.dietr...@rub.de Cc: r-help@r-project.org Sent: Thu, May 13, 2010 9:14:24 AM Subject: Re: [R] Path to R script At 13:19 Uhr -0700 12.05.2010, Shi, Tao wrote: Don't quite understand your question, but it looks like a more IT issue to me. I guess you store your R scripts in a central location (e.g. a server) and everybody call them from their own workstation, right? Thank you, but this would be an easy solution. The problem is that the R script and data tables are stored on the individual computers (and therefore on different places depending of the users' preferences and of course the operating system). If it were possible to locate the files relative to the script we could write modular scripts that would run on any machine without modifications. Thanks again, J. W. D. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Dr. Johannes W. Dietrich, M.D. -- Laboratory XU 44, Endocrine Research -- Medical Hospital I, Bergmannsheil University Hospitals -- Ruhr University of Bochum -- Buerkle-de-la-Camp-Platz 1, D-44789 Bochum, NRW, Germany -- Phone: +49:234:302-6400, Fax: +49:234:302-6403 -- eMail: ymailto=mailto:j.w.dietr...@medical-cybernetics.de; href=mailto:j.w.dietr...@medical-cybernetics.de;j.w.dietr...@medical-cybernetics.de -- WWW: http://medical-cybernetics.de -- WWW: http://www.bergmannsheil.de -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- __ 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] Multiple plots; single x(y) labels
Not sure why you want to do that b/c this can be done with one function call of xyplot in lattice. Anyway, you can always set axes=F and then replot each axis using 'axis' for each plot. Make sure before you do that, set your xlim and ylim, so all four plots have the same xlim and ylim. Like David said, you're re-inventing the wheels . ...Tao - Original Message From: Xin Ge xingemaill...@gmail.com To: David Winsemius dwinsem...@comcast.net Cc: r-help@r-project.org Sent: Thu, May 13, 2010 10:24:56 AM Subject: Re: [R] Multiple plots; single x(y) labels Hi David (and Others), I think I messed it up. Lets start afresh, I do not want to use lattice for this. I'm using multiple plot commands and then eventually would like to get a *combine* x-label and y-label for this plot. Like for example, the following plot has a combine x-label (Height) and one y-label (Weight) http://support.sas.com/documentation/cdl/en/grstateditug/61951/HTML/default/images/multi-panel-data.gif Is it possible to get a graph similar to above one using base R only ? # R code (this is just a sample data and not actual data I'm using) par(mfcol=c(2,2)) plot(1:3, 4:6, type = s, main = , ylab=, xlab=) plot(2:5, 5:8, type = s, main = , ylab=, xlab=) plot(3:6, 6:9, type = s, main = , ylab=, xlab=) plot(4:7, 6:9, type = s, main = , ylab=, xlab=) Thanks in advance, Xin On Thu, May 13, 2010 at 1:10 PM, David Winsemius ymailto=mailto:dwinsem...@comcast.net; href=mailto:dwinsem...@comcast.net;dwinsem...@comcast.netwrote: On May 13, 2010, at 12:59 PM, Xin Ge wrote: Hi David, Thanks for your reply. By single x and y-labels I meant something like this: http://zoonek.free.fr/blosxom//R/2006-08-10_lattice_xyplot_quakes.png which lattice gives by default. The code you sent doesn't seem to solve the problem, I'm sorry if I havent' explained it clearly before. Any comments? Yes. If you want lattice output, then don't use base graphics functions -- David. Thanks, Xin On Thu, May 13, 2010 at 12:51 PM, David Winsemius href=mailto:dwinsem...@comcast.net;dwinsem...@comcast.net wrote: On May 13, 2010, at 12:35 PM, David Winsemius wrote: ?plot # ylim and you need to have the data in a form (before plotting) where you can determine the shared max and min for the y limits On May 13, 2010, at 12:04 PM, Xin Ge wrote: Hi All, Can anyone please help me with getting a single x and y-axis label while plotting muliple plots. I'm still not sure what a single x-label might mean for such disparate series. Here is the code: par(mfcol=c(2,2)) plot(x - sort(rnorm(7)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(27)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(47)), type = s, main = , ylab=, xlab=) plot(x - sort(rnorm(67)), type = s, main = , ylab=, xlab=) randlist - list(); randlist[[1]] - sort(rnorm(7)) randlist[[2]] - sort(rnorm(27)) randlist[[3]] - sort(rnorm(47)) randlist[[4]] - sort(rnorm(67)) lapply(randlist, plot, ylim=c(min(rapply(randlist, min)), max(rapply(randlist,max))), type = s, xaxt=n, main = , ylab=, xlab=); par(opar) A minor refinement: opar - par(mfcol=c(2,2)) lapply(randlist, plot, ylim=c(Reduce(min, randlist), Reduce(max, randlist)), type = s, xaxt=n, main = , ylab=, xlab=) par(opar) also, how can remove x-tick lables using plot()? ?par # xaxt=n Thanks, Xin [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list target=_blank 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. David Winsemius, MD West Hartford, CT __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list target=_blank https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide href=http://www.R-project.org/posting-guide.html; target=_blank http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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,
Re: [R] read table for Fisher Exact
Hi Prof. Harrell, Could you please elaborate on why chi-square test is more appropriate in this case? Thank you very much! ...Tao - Original Message From: Frank E Harrell Jr f.harr...@vanderbilt.edu To: r-help@r-project.org Sent: Thu, May 13, 2010 5:35:07 AM Subject: Re: [R] read table for Fisher Exact On 05/12/2010 03:31 PM, visser wrote: i have 2 groups i want to compare: group A and group B each group contains let's say 20 patients i want to perform a Fisher Exact test on genotype distribution so, see if there is a sign diff in genotpe frequency/distribution (#AA, #AB, #BB) between group A and B not for 1, but for 1000 different genes my question: how should i build my table so i can do: test- read.table(table1.txt) fisher.test(test) i know a lot is still missing in the syntax, but i do not know what. any help would be soo much appreciated!! Note that in this case, Fisher's exact test has a good chance of being less accurate than an approximate Pearson chi-square test. -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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, reproducible code.
Re: [R] read table for Fisher Exact
Thanks, David! - Original Message From: David Winsemius dwinsem...@comcast.net To: Frank E Harrell Jr f.harr...@vanderbilt.edu Cc: Shi, Tao shida...@yahoo.com; r-help@r-project.org Sent: Thu, May 13, 2010 8:29:31 PM Subject: Re: [R] read table for Fisher Exact On May 13, 2010, at 9:24 PM, Frank E Harrell Jr wrote: On 05/13/2010 08:16 PM, Shi, Tao wrote: Hi Prof. Harrell, Could you please elaborate on why chi-square test is more appropriate in this case? Thank you very much! ...Tao Exact tests tend to not be very accurate. Typically their P-values are too large. See @Article{cra08how, author = {Crans, Gerald G. and Shuster, Jonathan J.}, title = {How conservative is {Fisher's} exact test? {A} quantitative evaluation of the two-sample comparative binomial trial}, journal = Statistics in Medicine, year = 2008, volume = 27, pages = {3598-3611}, annote = {Fisher's exact test; $2\times 2$ contingency table;size of test; comparative binomial experiment;first paper to truly quantify the conservativeness of Fisher's test;``the test size of FET was less than 0.035 for nearly all sample sizes before 50 and did not approach 0.05 even for sample sizes over 100.'';conservativeness of ``exact'' methods;see \emph{Stat in Med} \textbf{28}:173-179, 2009 for a criticism which was unanswered} } Lest you be concerned that Frank is selectively citing the literature, here are a few more citations demonstrating problems with exact methods, starting with the citation in the prop.test help page: http://www.stats.org.uk/statistical-inference/Newcombe1998.pdf And a few others: http://www.jstor.org/pss/2685469 http://www.ine.pt/revstat/pdf/rs080204.pdf http://goliath.ecnext.com/coms2/gi_0199-4388181/Evaluation-criteria-for-discrete-confidence.html http://www.math.ist.utl.pt/~apires/PDFs/AP_COMPSTAT02.pdf Some R methods: http://finzi.psych.upenn.edu/R/library/PropCIs/html/add4ci.html http://finzi.psych.upenn.edu/R/library/pairwiseCI/html/pairwiseCImethodsProp.html http://finzi.psych.upenn.edu/R/library/Epi/html/ci.pd.html http://finzi.psych.upenn.edu/R/library/binMto/html/binMtoMethods.html http://finzi.psych.upenn.edu/R/library/pairwiseCI/html/pairwiseCI.html - Original Message From: Frank E Harrell Jr ymailto=mailto:f.harr...@vanderbilt.edu; href=mailto:f.harr...@vanderbilt.edu;f.harr...@vanderbilt.edu To: href=mailto:r-help@r-project.org;r-help@r-project.org Sent: Thu, May 13, 2010 5:35:07 AM Subject: Re: [R] read table for Fisher Exact On 05/12/2010 03:31 PM, visser wrote: i have 2 groups i want to compare: group A and group B each group contains let's say 20 patients i want to perform a Fisher Exact test on genotype distribution so, see if there is a sign diff in genotpe frequency/distribution (#AA, #AB, #BB) between group A and B not for 1, but for 1000 different genes my question: how should i build my table so i can do: test- read.table(table1.txt) fisher.test(test) i know a lot is still missing in the syntax, but i do not know what. any help would be soo much appreciated!! Note that in this case, Fisher's exact test has a good chance of being less accurate than an approximate Pearson chi-square test. --Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;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. David Winsemius, MD West Hartford, CT __ 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] a question about latex in Hmisc
Hi list, Excuse me b/c this is probably a more TeX then R question. I've been using latex function in my .Rnw file to generate tables, but I've always been using it without assigning the result to a object, i.e. x - matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','this that'))) latex(x) so, I always get the error window (attached) poped out. But since I can just click OK and everything seems fine except in my working directory I get a bunch of junk files (.log, .dvi, etc...), I've been ignoring it. Now I know by doing e.g. tmp - latex(x) will suppress this error message, but I'm still curious on how to get rid of the error window when I just use latex(x). I read the Example section of latex help file and I tried to include the following into my PATH: C:\Program Files\MiKTeX 2.7\tex\latex but that didn't work. I'm using R.2.11.0, Hmisc 3.7, and MiKtex 2.7 on WinXP. Thanks! ...Tao __ 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] Whiskers on the default boxplot {graphics}
Jason, All these are clearly defined in the help file for 'boxplot' under 'range'. Don't understand how you missed that. ...Tao - Original Message From: Jason Rupert jasonkrup...@yahoo.com To: Dennis Murphy djmu...@gmail.com Cc: R Project Help R-help@r-project.org Sent: Wed, May 12, 2010 3:40:12 AM Subject: Re: [R] Whiskers on the default boxplot {graphics} Fantastic! It would be great if the description could be modified to include the mysterious bit about the upper and lower bound whisker positions: upper whisker = min(max(x), Q_3 + 1.5 * IQR) lower whisker = max(min(x), Q_1 - 1.5 * IQR) Maybe that is clearly written in the description of boxplot.stats {grDevices}, but evidently I missed it numerous times and also did not pick up on this intent from the original description of boxplot {graphics}. Your type of descriptive answer and helpfulness is much appreciated and one of the reasons I continue to endorse the R tool over numerous others. More like you and the tool may be headed for domination in the market. Thanks again! From: Dennis Murphy href=mailto:djmu...@gmail.com;djmu...@gmail.com Cc: R Project Help href=mailto:R-help@r-project.org;R-help@r-project.org Sent: Wed, May 12, 2010 2:50:19 AM Subject: Re: [R] Whiskers on the default boxplot {graphics} Hi: Let's do some math :) e: Okay...Let me see if I've got it... I'm just trying to use the default boxplot {graphics} capability in R... So I call something like the following: boxplot(mpg~cyl,data=mtcars, main=Car Milage Data, xlab=Number of Cylinders, ylab=Miles Per Gallon) \ That produces something as shown in the following: http://www.statmethods.net/graphs/images/boxplot1.jpg When that default boxplot is called, i.e. boxplot {graphics}, as shown in the line of code above, it is actually calling into boxplot.stats {grDevices}. When boxplot.stats {grDevices} is called it has a default value for coef of 1.5, i.e. coef = 1.5. If I understand the purpose of coef correctly, it means that the ‘whiskers’ should extend out 1.5 times the length of the box away from the box. Is that correct? If by 'length of the box' you mean the interquartile range (IQR = Q_3 - Q_1 where Q refers to quartile), then assuming that x is the numeric vector of interest for a boxplot, upper whisker = min(max(x), Q_3 + 1.5 * IQR) lower whisker = max(min(x), Q_1 - 1.5 * IQR) So the upper whisker is located at the *smaller* of the maximum x value and Q_3 + 1.5 IQR, whereas the lower whisker is located at the *larger* of the smallest x value and Q_1 - 1.5 IQR. In your terms, the whiskers should extend out a *maximum* of 1.5 times the length of the box away from the box. Visually, this means that individual points more extreme in value than Q3 + 1.5 IQR are plotted separately at the high end, and those below Q1 - 1.5 IQR are plotted separately on the low end. Depending on the source, the separately plotted points are called 'outside values'. On the other hand, if the maximum or minimum values of x are closer than 1.5 IQR in distance from its nearest quartile, then that is where the whisker is positioned. Does that make sense? HTH, Dennis Now I look back at the plot, and I'm not sure how 1.5 times the length of the box corresponds with the whisker lengths shown in the image: href=http://www.statmethods.net/graphs/images/boxplot1.jpg; target=_blank http://www.statmethods.net/graphs/images/boxplot1.jpg Is it that the whisker length is a total of 1.5 the length of the box and centered about the median (2nd Quartile)? Just trying to get a handle on this, so thanks again for all the help in deciphering this. From: RJ Cunningham href=mailto:ro...@iinet.net.au;ro...@iinet.net.au target=_blank href=http://ast.net;ast.net Cc: R Project Help href=mailto:R-help@r-project.org;R-help@r-project.org Sent: Tue, May 11, 2010 9:57:48 PM Subject: Re: [R] Whiskers on the default boxplot {graphics} I think not. Isn't the secret here? Arguments: x: a numeric vector for which the boxplot will be constructed ('NA's and 'NaN's are allowed and omitted). coef: this determines how far the plot 'whiskers' extend out from the box. If 'coef' is positive, the whiskers extend to the most extreme data point which is no more than 'coef' times the length of the box away from the box. A value of zero causes the whiskers to extend to the data extremes (and no outliers be returned). do.conf,do.out: logicals; if 'FALSE', the 'conf' or 'out' component respectively will be empty in the result. Details: The two 'hinges' are versions of the first and third quartile,... On Wed May 12 10:35 , Jason Rupert sent: HummMaybe I need to look some place else than boxplot.stats {grDevices} for a definition of how the
Re: [R] a question about latex in Hmisc
Hi Erik, Thanks for the quick reply! My attachment was in .png which should be supported by the list I'm resending it. Yes, I knew by assigning it to an object, I can avoid this. But, I'm curious to know what if I choose to do e.g. just latex(x), how can I get rid of the error window. It actually worked for me once (i.e. I got Yap poped out to preview the table I'm generating), but I had no idea what I did differently. ...Tao - Original Message From: Erik Iverson er...@ccbr.umn.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Wed, May 12, 2010 12:27:32 PM Subject: Re: [R] a question about latex in Hmisc Shi, Tao wrote: Hi list, Excuse me b/c this is probably a more TeX then R question. I've been using latex function in my .Rnw file to generate tables, but I've always been using it without assigning the result to a object, i.e. x - matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','this that'))) latex(x) so, I always get the error window (attached) poped out. But since I can just click OK and everything seems fine except in my working directory I get a bunch of junk files (.log, .dvi, etc...), I've been ignoring it. Your attachment did not come through, most likely because it is not a type that is supported by the list. Now I know by doing e.g. tmp - latex(x) will suppress this error message, but I'm still curious on how to get rid of the error window when I just use latex(x). I read the Example section of latex help file and I tried to include the following into my PATH: C:\Program Files\MiKTeX 2.7\tex\latex Well I can't directly help you with your issue, since I don't know what error you're receiving, the reason this is happening is that when you don't assign the result of your latex call, the function 'print.latex' is getting called, which if I understand tries to compile the LaTeX output and display the result in a suitable viewer. By assigning the results of the latex call in R, you stop this printing from happening. As for what your issue is, I don't know since your attachment did not come through. __ 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] a question about latex in Hmisc
Hi Richard, Obviously, the list doesn't like my attachment. Here it is: http://i41.tinypic.com/15qz387.jpg I set the path using Windows control panel. And didn't work means I'm still getting the same error window shown above. ...Tao - Original Message From: Richard M. Heiberger r...@temple.edu To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org Sent: Wed, May 12, 2010 12:34:13 PM Subject: Re: [R] a question about latex in Hmisc Shi, Tao wrote: so, I always get the error window (attached) poped out. The image was stripped by the mailer. Please type the text of the error into the body of the email. I tried to include the following into my PATH: C:\Program Files\MiKTeX 2.7\tex\latex Where? In the Windows environment on the Control Panel? Through R? What does R think the the path is? Sys.getenv(PATH) Does it have two backslash characters everywhere you only one backslash character? My R shows C:\\Program Files\\MiKTeX 2.7\\miktex\\bin; but that didn't work. Please define didn't work. Include the full message that you received. Rich __ 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.