Re: [R] Relocating Axis Label/Title --2
You don't need to move anything. Just allocate more room for what you have already. Try this: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) ### par(mar = c(4.5, 4.5, 1, 1) + 0.1)# ### plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) axis(2, mgp=c(0, 0.2, -2)) dev.off() Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lorenzo Isella Sent: Wednesday, August 08, 2007 12:53 PM To: r-help@stat.math.ethz.ch Subject: [R] Relocating Axis Label/Title --2 Apologies for the previous mail (I sent it off too early by mistake). This is the correct example: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) axis(2, mgp=c(0, 0.2, -2)) dev.off() With mgp() I can tune the distance between the ticks and the tick labels, but how can I move the axis label? I would like to move the one along y to visualize correctly the exponent 3. Kind Regards Lorenzo On 08/08/07, Lorenzo Isella [EMAIL PROTECTED] wrote: Dear All, I am experiencing some problems with relocating an axis title. I visited the following link before posting: http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html But this is not entirely what I would like to do Consider the example below: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) title(2, mgp=c(0, .3, 0)) dev.off() I have the problem that the 3 in cubic centimeters (on the y axis) is somehow cut in the pdf file I generate. Everything would be fine if I could shift a bit the title of the y axis. It must be trivial, but so far I have not managed to do it. Any suggestions? Many thanks Lorenzo I tried playing with the mgp parameter, but I managed to move the __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Relocating Axis Label/Title --2 (Second try.)
I hate it when the line feeds get lost and the message becomes unintelligible. I'm sorry. You don't need to move anything. Just allocate more room for what you have already. Try this: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) ### par(mar = c(4.5, 4.5, 1, 1) + 0.1) ### plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) axis(2, mgp=c(0, 0.2, -2)) dev.off() Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lorenzo Isella Sent: Wednesday, August 08, 2007 12:53 PM To: r-help@stat.math.ethz.ch Subject: [R] Relocating Axis Label/Title --2 Apologies for the previous mail (I sent it off too early by mistake). This is the correct example: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) axis(2, mgp=c(0, 0.2, -2)) dev.off() With mgp() I can tune the distance between the ticks and the tick labels, but how can I move the axis label? I would like to move the one along y to visualize correctly the exponent 3. Kind Regards Lorenzo On 08/08/07, Lorenzo Isella [EMAIL PROTECTED] wrote: Dear All, I am experiencing some problems with relocating an axis title. I visited the following link before posting: http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html But this is not entirely what I would like to do Consider the example below: rm(list=ls()) D_mean-seq(-5,5,length=100) y-exp(-D_mean^2/5) pdf(my.pdf) plot(D_mean,y,type=l,yaxt=n,lty=2,lwd=2,col=black, ylab = list(expression(paste(dN/dlogD[agg], [*cm^-3*]))), xlab = expression(paste(D[agg], [nm])), cex.lab=1.2 ) title(2, mgp=c(0, .3, 0)) dev.off() I have the problem that the 3 in cubic centimeters (on the y axis) is somehow cut in the pdf file I generate. Everything would be fine if I could shift a bit the title of the y axis. It must be trivial, but so far I have not managed to do it. Any suggestions? Many thanks Lorenzo I tried playing with the mgp parameter, but I managed to move the __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] elementary statistics with R (rkward?)
Face the music and buy the book: _Introductory Statistics with R_ by Peter Dalgaard. It's perfect for what you need. It's clear and concise and will teach you statistics AND R as painlessly as such a thing can be. It's inexpensive and you can get it on Amazon.com and every other major bookseller, including the nearest university bookstore. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Donatas G. Sent: Wednesday, July 11, 2007 9:27 AM To: r-help@stat.math.ethz.ch Subject: [R] elementary statistics with R (rkward?) Hi, I am trying to learn some basic statistics stuff but I cannot find any elementary statistics exercises using R language. Using RKward would be even better... I need that in analysing sociological data, obtained through questionnairres - findind corelations between variables, relations between different types of data, etc. Could anyone recommend simple tutorials/exercises, available on www for me to work on? I realize it would be much simple to do this introductory stuff with spss, that everyone around me is using here in Lithuania, but I'd really like to learn to do it with R instead... -- Donatas G. __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Split graphs
Jessie: How many pixels would you need to allocate for each of these 1000 parts? Is that feasible? Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of tian shen Sent: Monday, July 09, 2007 3:43 AM To: r-help@stat.math.ethz.ch Subject: [R] Split graphs Hello All, I have a question, which somehow I think it is easy, however, I just couldn't get it. I want to histogram each row of a 1000*2 matrix( means it has 1000 rows), and I want to see those 1000 pictures together. How can I do this? Am I able to split a graph into 1000 parts and in each parts it contains a histogram for one row? Thank you very much Jessie - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Highliting a text in a plot
Maja: This will work. It's quick. It's easy. And it probably isn't what you want because there is room for an unplotted symbol on the left. But it might suffice. plot(NA, xlim=0:1, ylim=0:1)## legend(x=0.5, y = 0.5, hallo, bg=yellow, col=dark blue, box.lty=0) You can look at the code for legend (?legend) and modify it, or use parts of it for your own function. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Maja Schröter Sent: Saturday, June 23, 2007 4:55 PM To: r-help@stat.math.ethz.ch Subject: [R] Highliting a text in a plot Hi everyone, I want to highlight something in a plot. So I want to write a text with a yellow background. I tried to make use of text(x,y,hallo,bg=yellow) but that does not work. I know I am a handful. Sorry! Maja! -- __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Inverse BoxCox transformation
Look at the definition for the transform. For example in the car package, ?box.cox Then do the simple algebraic manipulations yourself. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Des Callaghan Sent: Monday, June 18, 2007 3:33 AM To: r-help@stat.math.ethz.ch Subject: [R] Inverse BoxCox transformation Hi, I can't seem to find a function in R that will reverse a BoxCox transformation. Can somebody help me locate one please? Thanks in advance. Best wishes, Des [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 specify the start position using plot
plot( x=rnorm(25, 0.5, 0.3), y=rnorm(25, 4, 1), xlim=c(0,1), ylim=c(2,7)) # ^^ for example Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Wang Sent: Sunday, June 10, 2007 12:25 PM To: r-help@stat.math.ethz.ch Subject: [R] How to specify the start position using plot Hi, How to specify the start position of Y in plot command, hopefully I can specify the range of X and Y axis. I checked the ?plot, it didnot mention I can setup the range. Thanks Pat __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Excel calling R functions
You might consider having R do everything: R can read the Excel sheet, do what needs to be done, and write the results to an Excel sheet. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Horace Tso Sent: Friday, June 01, 2007 11:51 AM To: r-help@stat.math.ethz.ch Subject: [R] Excel calling R functions Hi folks, Is it possible to have Excel call a R function. If not, how about making Excel send off a command to call a R script and then read the result back into Excel. I know, I know, this should belong to some Excel forum, but i just try my luck here. Thanks in advance. Horace W. Tso __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] graphics edge in win.metafile?
Try using Paste, Special in WORD or PowerPoint. The graphic will be slightly smaller too but I find the size is just right. What works better for me, but does require some forethought, is something like this: graphics.off() windows(width = 5.8, height = 5.8, pointsize = 12) par(mar = c(4.5, 4.5, 4, 0.5) + 0.1)# -- sized to fit your graphic. ###Customizing par() may solve your cut paste problem, too. ### ### graphic generating logic goes here. ### savePlot(graphic name, type = wmf) The rather than cut paste, I use WORD or PowerPoint's insert to point to the new graphic. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of LL Sent: Saturday, May 26, 2007 1:14 PM To: LL; r-help@stat.math.ethz.ch Subject: [R] graphics edge in win.metafile? Hi... I copy a plot to the clipboard via win.metafile and then paste the clipboard into a powerpoint show. The problem is that there is considerable white space between the edges of the plot and the figure pasted into powerpoint. I've tried many par settings to get less white space between the plot sides and the bounding box.. but haven't succeeded. win.metafile(, height=3, width=3) plot(1:10) dev.off() Thanks, Lance [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Truncating trailing digits
Perhaps format is what you are looking for: ?format Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pietrzykowski, Matthew (GE, Research) Sent: Thursday, May 03, 2007 12:14 PM To: r-help@stat.math.ethz.ch Subject: [R] Truncating trailing digits Hello, I am relatively new to R and have a rudimentary question, I think. How does one truncate the number of digits displayed after the decimal when viewing the results of analyses? My apologies if this question has been answered previously, I was not able to find references very easily. Thank you in advance, Matt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] RWinEdt and Windows Vista
Dimitri: Several of us early Vista users have encountered difficulties that ultimately were related to Vista's treating only the Administrator as having permission to make some changes. Even if you are the only user, you still do not have administrative privileges by default. (I think this is a good thing since it diminishes accidental or malicious changes). With R the problem surfaces when trying to install packages. The problem is easily mitigated by running R as the administrator and installing the packages or updates. (Subsequent R sessions can be run by double clicking on the icon, as usual.) To do that, right-click on the program's icon and choose Run as administrator. Perhaps this will solve your RWinEdt problems as well. Best wishes! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitri Szerman Sent: Saturday, April 28, 2007 11:51 AM To: R-Help Subject: [R] RWinEdt and Windows Vista Hi, I have a new computer with Windows Vista and I am trying to use RWinEdt, which I have always used. I am using R version 2.5. The installation of the RWinEdt library is funny. First, it didn't install at all. Then, I uninstalled/reinstalled both R and WinEdt, downloaded the package again from the CRAN repositary, got some error messages, but RWinEdt initialized. I closed R and WinEdt, launched R again, type library(RWinEdt), and got several dialogue boxes (again), asking if I wanted to creat shortcuts, etc. Then, RWinEdt didn't work anymore. I'm sorry for the messy email, but I've done so many installations/uninstallations/re installations, that I am alos confused. I guess the ultimate questions is: are there any known issued between R, RWinEdt and Windows Vista? I appreciate any help. Thanks, Dimitri __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Another newbie book recommandation question
Oh, Boy. This might result in a data dump since each of us has a personal library. Here are the top dozen or so from mine: 1. Agresti, Alan, Categorical Data Analysis, 2nd ed., Wiley, 2002 2. Box, George E. P., William G. Hunter, and J. Stewart Hunter, Statistics for Experimenters, Wiley, 1978 3. Casella, George and Roger L. Berger, Statistical Inference, Duxbury Press, 2001 4. Chatfield, C., The Analysis of Time Series, 4th ed., Chapman Hall, 1989 5. Cressie, Noel A. C., Statistics for Spatial Data, Wiley, 1993 6. Fisher, Ronald A., Statistical Methods for Research Workers. (First published in 1925; 14th edition was ready for publication in 1962, when Fisher died, and was published in 1990, by the Oxford University Press, along with Experimental Design and Scientific Inference, with corrections to the 1991 edition, in 1993.) 7. Efron, Bradley and Robert J. Tibshirani, An Introduction to the Bootstrap, Chapman and Hall, 1993 8. Gelman, Andrew, John B. Carlin, Hal S. Stern, Donald B. Rubin, Bayesian Data Analysis, 2nd ed., Chapman Hall/CRC, 2003 9. Johnson, Richard A. and Dean W. Wichern, Applied Multivariate Statistical Analysis, 5th ed., Prentice Hall, 20021988 10. Kutner, Michael, and Christopher J. Nachtsheim, John Neter, William Li, Applied Linear Statistical Models, 5th ed., McGraw-Hill/Irwin, 2005 11. Lawless, Jerald F., Statistical Models and Methods for Lifetime Data, Wiley, 1982 12. McCullagh, P. and J.A. Nelder, Generalized Linear Models, Chapman Hall, 2nd ed., 1989 13. Meeker and Escobar, Statistical Methods for Reliability Data, Wiley, 1998 14. Robert, Christian P. and George Casella, Monte Carlo Statistical Methods, Springer, 1999 15. Venables and Ripley, Modern Applied Statistics with S, 4th ed., Springer, 2002 Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zembower, Kevin Sent: Thursday, March 01, 2007 10:07 AM To: r-help@stat.math.ethz.ch Subject: [R] Another newbie book recommandation question I hope this question is sufficiently different from the other requests for book recommendations that it's not repetitious. If not, I apologize in advance. I'm curious what standard reference books working statisticians, or biostatisticians, have within easy reach of their desk. I'm a computer systems administrator, and have a two-foot bookshelf directory under my monitor that contains 13 paperback manuals that I refer to frequently, some once or twice a day. Are there standard reference works for statisticians that are used the same way? From reading this list, I'm guessing that one might be W. N. Venables and B. D. Ripley (2002), Modern Applied Statistics with S. Fourth Edition, Springer, ISBN 0-387-95457-0. However, I'm not limiting this to books pertaining to R. On the other hand, maybe Google and other on-line sources, as well as interactive programs like R that can spit out numbers previously looked up in tables, have completely replaced the need for reference books. Is this the case today? I'm particularly interested in reference books that may be helpful in my organization's work. We typically deal with datasets from international Demographic and Health Surveys (DHS) similar to those available at http://www.measuredhs.com/aboutsurveys/search/search_survey_main.cfm?Srv yTp=typelisttypes=1. These typically contain 10,000+ respondents and can have up to 800 fields. We currently analyze these datasets using Stata. Thanks for taking the time to think about and respond to this question. I'll summarize the answers in a later post for the archive. -Kevin Kevin Zembower Internet Services Group manager Center for Communication Programs Bloomberg School of Public Health Johns Hopkins University 111 Market Place, Suite 310 Baltimore, Maryland 21202 410-659-6139 __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Random Integers
Sure. rpois(n, lambda) ... will do it. But you should tell us something about how you want your numbers to be distributed, since rpois() produces integers having a Poisson distribution. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anup Nandialath Sent: Sunday, February 25, 2007 1:51 AM To: r-help@stat.math.ethz.ch Subject: [R] Random Integers Hi all, Is there an R function to generate random integers? Thanks in advance. Sincerely Anup - Now that's room service! Choose from over 150,000 hotels [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Updating or installing R packages on Windows Vista
Or you can right-click on the R icon and choose Run as administrator. That way you won't alter the security settings and forget to re-set them. After the packages are installed R will load in the usual way by clicking on the icon. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Albert Sent: Wednesday, February 21, 2007 10:23 PM To: r-help@stat.math.ethz.ch Subject: [R] Updating or installing R packages on Windows Vista Hi, Windows Vista includes additional security mechanisms (User Access Control) whose defaults make it difficult to install or update R packages. To avoid these problems you need to go to Computer- Program Files Right click on the R directory and select properties. Now select the security tab. Give your user ( which is the use R whose priviledges R runs under) Full Control to the R directory. This should solve the install/update issues. Keep up the good work. Chris Albert [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 book advice
I know you asked for a comparison (which I can't provide) but on an absolute scale for a beginner it'd be hard to beat Dalgaard (Introductory Statistics with R). It assumes nothing, and teaches you statistics in a lucid no-nonsense way AND teaches you R along the way as a mechanism for implementing the statistical thinking you've acquired. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Lynch Sent: Thursday, February 15, 2007 6:35 PM To: r-help@stat.math.ethz.ch Subject: [R] R book advice I'm looking for a book for someone completely ignorant of statistics who wishes to learn both statistics and R. I've found three possibilities, one by Verzani (Using R for Introductory Statistics), one by Crawley (Statistics: An Introduction using R), and one by Dalgaard (Introductory Statistics with R). Do these books have different emphases, perspectives, or strengths? Should I just pick one at random and buy it? Thanks, --Paul __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing packages and windows vista
Thank you Dan! I dunno if I would have ever found that. Thanks! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 9:49 AM To: Duncan Murdoch; [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] installing packages and windows vista Opening R by right clicking and choosing run as administrator' worked. Was able to run install packages without a problem. I have not tested the other methods suggested. thank you. Dan O'Shea -- Original message -- From: Duncan Murdoch [EMAIL PROTECTED] On 2/6/2007 10:33 AM, Daniel O'Shea wrote: I installed R (R-2.4.1-win32.exe) on a new computer with Windows Vista and a 64 bit operating system (hp dv9000 with intel core t7200). The base R runs fine, but I can not get any of the packages to load. From within R I choose install packages choose a site then a package. I tried installing 2 packages and get similar errors (see below), I just copied and pasted lines from R. Can anyone offer any suggestions? Thank you. I believe that on Vista you need to do like other OS's, and run package installs at a higher security level than the default. I don't have Vista so I've never done this, but I've been told you do it by right clicking on the R icon and choosing Run as administrator. I'd be interested in hearing if this is true of all package installs, or only installs to C:/Program files. Can you have a local library for your user, with only user permissions needed to modify packages there? You'd test this by creating a library directory in your own file space, then using .libPaths() to add it to the library location list. By default new installs would go there. Duncan Murdoch Dan O'Shea utils:::menuInstallPkgs() --- Please select a CRAN mirror for use in this session --- also installing the dependencies 'scatterplot3d', 'rgl', 'ellipse' trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/scatterplot3d_0.3-24.zip' Content type 'application/zip' length 540328 bytes opened URL downloaded 527Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/rgl_0.70.zip' Content type 'application/zip' length 838137 bytes opened URL downloaded 818Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/ellipse_0.3-4.zip' Content type 'application/zip' length 91877 bytes opened URL downloaded 89Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/vegan_1.8-5.zip' Content type 'application/zip' length 1176434 bytes opened URL downloaded 1148Kb Error in zip.unpack(pkg, tmpDir) : cannot open file 'C:/Program Files (x86)/R/R-2.4.1/library/file60bf5753/scatterplot3d/chtml/scatterplot3d.chm' utils:::menuInstallPkgs() also installing the dependencies 'akima', 'gam', 'RColorBrewer', 'sm', 'deldir', 'sp', 'maps', 'spatstat', 'PBSmapping', 'gpclib', 'RArcInfo', 'tkrplot', 'maptools', 'mapproj', 'rgl', 'qcc', 'sgeostat', 'acepack', 'TeachingDemos', 'chron', 'Hmisc' trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/akima_0.5-1.zip' Content type 'application/zip' length 128809 bytes opened URL downloaded 125Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/gam_0.98.zip' Content type 'application/zip' length 238008 bytes opened URL downloaded 232Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/RColorBrewer_0.2-3.zip' Content type 'application/zip' length 39787 bytes opened URL downloaded 38Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/sm_2.1-0.zip' Content type 'application/zip' length 400621 bytes opened URL downloaded 391Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/deldir_0.0-5.zip' Content type 'application/zip' length 108656 bytes opened URL downloaded 106Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/sp_0.9-4.zip' Content type 'application/zip' length 747542 bytes opened URL downloaded 730Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/maps_2.0-33.zip' Content type 'application/zip' length 2219136 bytes opened URL downloaded 2167Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/spatstat_1.11-0.zip' Content type 'application/zip' length 4558460 bytes opened URL downloaded 4451Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/PBSmapping_2.09.zip' Content type 'application/zip' length 6725596 bytes opened URL downloaded 6567Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/gpclib_1.3-3.zip' Content type 'application/zip' length 95120 bytes opened URL downloaded 92Kb trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.4/RArcInfo_0.4-7.zip' Content type 'application/zip' length
Re: [R] Text position in Traditional Graphics
A few days a go Jim Holman [EMAIL PROTECTED] suggested this (Re: [R] How to annotate a graph with non-transparent math labels?) for a similar circumstance. Perhaps it will for in your case. try using strwidth strheight x-c(0,1) plot(x,x,type='l') dimensions-matrix(c(strwidth(expression(theta),cex=5),strheight(expression( theta), cex=5)),nrow=1) symbols(0.5,0.5 ,rectangle=dimensions,bg='white',fg='white',add=TRUE,inches=FALSE) text(0.5,0.5,expression(theta),cex=5) ~ Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Prager Sent: Wednesday, January 24, 2007 4:30 PM To: r-help@stat.math.ethz.ch Subject: [R] Text position in Traditional Graphics R 2.4.1 on Windows XP. Question: In traditional graphics, is it possible to find out the height of a line of text in units that can be used in arithmetic and then in calls to text()? Context: I have written a function that draws a plot and then, depending on whether some arguments are TRUE or FALSE, draws various lines of text in the plot. The text lines may be turned on or off individually by the user. The function uses plot() and several calls to text(). However, I have not found a good way to adjust the Y coordinate of the text for lines after the first. I would like this to work when the graphics device (windows) is opened at (or resized to) a wide range of sizes. The issue is that a line of text takes up a smaller fraction of the total Y span of the plotting region as the window gets larger. It seems this can be done with grid graphics, but although I plan to learn grid, I am hoping that for now, I can do this work with traditional graphics. Thanks! -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 on Windows Vista
I've run R on the 32 bit version of Vista. Because of Vista's extra security controls you can't install a library easily, however, even though I had not trouble installing R. You must first set the security level to allow it (I can't recall the details but it's not to difficult to figure out), then install the libraries, then re-set the security levels. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sicotte, Hugues Ph.D. Sent: Tuesday, January 16, 2007 9:36 AM To: r-help@stat.math.ethz.ch Subject: [R] R on Windows Vista Did anyone try to run R under Window Vista, especially Windows Vista 64bit? Thanks. __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] persistant: Matlab-R
It might be helpful to those not familiar with Matlab to tell us what function persistent does. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bernard Gregory Sent: Thursday, December 14, 2006 1:14 PM To: r-help@stat.math.ethz.ch Subject: [R] persistant: Matlab-R Dear list members, Could anyone tell me if there is an equivalent of the Matlab declaration 'persistant' in R? Thank you very much, Bernard Gregorry. (Matlaber converted to R). - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] .First.lib
Greetings: Im running R version 2.4.0 (2006-10-03) on WindowsXP in a 3 year old DELL box with 2 gig. I have successfully created a zipped package, mh1823_2.1.zip, using R CMD build --binary mh1823. R CMD build --binary automatically adds a file, mh1823, containing .First.lib and its default function definition. I would like to supply my own .First.lib function to create menus when the package is loaded by calling my menu-creator function. It is easy to do after the package is installed from mh1823_2.1.zip, but I want my .First.lib function to be part of mh1823_2.1.zip in the first place. Is there a way that I can use R CMD build --binary, with its zip file output, but substitute my .First.lib function for the default? Thanks for any help. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] .First.lib
Thank you Professor Ripley. I don't have compiled code and do not have a namespace, which is required (I understand) to use onLoad. The package is of moderate size, however with about 100 R functions. I know that I could emulate the technique used by Rcmdr, but had hoped to use R CMD build --binary. Should I just declare a namespace and use onLoad, or is there a mechanism to use my own .First.lib? Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Saturday, November 18, 2006 12:53 PM To: Charles Annis, P.E. Cc: r-help@stat.math.ethz.ch Subject: Re: [R] .First.lib On Sat, 18 Nov 2006, Charles Annis, P.E. wrote: Greetings: I'm running R version 2.4.0 (2006-10-03) on WindowsXP in a 3 year old DELL box with 2 gig. I have successfully created a zipped package, mh1823_2.1.zip, using R CMD build --binary mh1823. R CMD build --binary automatically adds a file, mh1823, containing .First.lib and its default function definition. How does it do that? (I've never seen it do so.) What it is documented to do is to create a binary package with a file mh1823/R/mh1823 which contains code you put in the package sources, so I am pretty sure you defined .First.lib. I would like to supply my own .First.lib function to create menus when the package is loaded by calling my menu-creator function. It is easy to do after the package is installed from mh1823_2.1.zip, but I want my .First.lib function to be part of mh1823_2.1.zip in the first place. Is there a way that I can use R CMD build --binary, with its zip file output, but substitute my .First.lib function for the default? All packages that I am aware of on CRAN which use compiled code have their own .First.lib or .onLoad, normally in file R/zzz.R. -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch 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] .First.lib
Perseverance, I guess, is the answer. Thank you exceedingly Professor Ripley for your help. Things do look awfully simple on this side of success. At your suggestion (after several false starts) I defined a .First.lib function within a file named zzz.R and built with R CMD build --binary, loaded the new package and there were my new menus. Thanks again. Sheepishly, Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Saturday, November 18, 2006 1:54 PM To: 'Prof Brian Ripley' Cc: r-help@stat.math.ethz.ch Subject: Re: [R] .First.lib Thank you Professor Ripley. I don't have compiled code and do not have a namespace, which is required (I understand) to use onLoad. The package is of moderate size, however with about 100 R functions. I know that I could emulate the technique used by Rcmdr, but had hoped to use R CMD build --binary. Should I just declare a namespace and use onLoad, or is there a mechanism to use my own .First.lib? Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Saturday, November 18, 2006 12:53 PM To: Charles Annis, P.E. Cc: r-help@stat.math.ethz.ch Subject: Re: [R] .First.lib On Sat, 18 Nov 2006, Charles Annis, P.E. wrote: Greetings: I'm running R version 2.4.0 (2006-10-03) on WindowsXP in a 3 year old DELL box with 2 gig. I have successfully created a zipped package, mh1823_2.1.zip, using R CMD build --binary mh1823. R CMD build --binary automatically adds a file, mh1823, containing .First.lib and its default function definition. How does it do that? (I've never seen it do so.) What it is documented to do is to create a binary package with a file mh1823/R/mh1823 which contains code you put in the package sources, so I am pretty sure you defined .First.lib. I would like to supply my own .First.lib function to create menus when the package is loaded by calling my menu-creator function. It is easy to do after the package is installed from mh1823_2.1.zip, but I want my .First.lib function to be part of mh1823_2.1.zip in the first place. Is there a way that I can use R CMD build --binary, with its zip file output, but substitute my .First.lib function for the default? All packages that I am aware of on CRAN which use compiled code have their own .First.lib or .onLoad, normally in file R/zzz.R. -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch 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@stat.math.ethz.ch 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] trouble loading example package
Yes, I am using WindowsXP on a 3 year old DELL machine with 2 gig. I apologize to Professor Ripley and our other helpers for my omission. I also tried R CMD build --binary mypkg, as was suggested by Benilton Carvalho, and with a similar error message. I don't think I want binaries in any event. Still struggling. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Thursday, November 16, 2006 4:44 AM To: Charles Annis, P.E. Cc: r-help@stat.math.ethz.ch Subject: Re: [R] trouble loading example package This appears to be about Windows, unstated! On Thu, 16 Nov 2006, Charles Annis, P.E. wrote: Greetings: I've installed Rtools, MikTeX, perl, minGW, and HTML Help Workshop, and have succeeded in making, checking (using R CMD check mypkg) then building the simple example package.skeleton(list=c(f,g,d,e), name=mypkg) R CMD build mypkg produces a tarball. I don't know how to get a zip file. But when I try to Install package(s) from local zip files, I get this error message: Error in gzfile(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open compressed file 'mypkg/DESCRIPTION' But when I click on that file in the tarball it opens and shows me what I expected. But you don't have a zip file, which is what warning 1 has told you. I had hoped that I had weathered the hard part - building the package - but You haven't: the interesting part is INSTALLing the package. I still need some help: 1) How do I get a zipped file, rather than a tarball, R CMD INSTALL --build (preferably) R CMD build --binary 2) How do I install what I've built? R CMD INSTALL foo_1.0.0.tar.gz -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch 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@stat.math.ethz.ch 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] trouble loading example package
Thank you, Benilton. I started over from scratch, and this time, using R CMD build --binary mypkg I was successful. I am not sure where I made my original mistake, but I think it was in overlooking one of the instruction/comment lines in mypkg-package.Rd Thank you again for your help. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benilton Carvalho Sent: Thursday, November 16, 2006 12:38 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] trouble loading example package How do you build your packages? have you tried R CMD build --binary mypkg b On Nov 16, 2006, at 12:32 AM, Charles Annis, P.E. wrote: Greetings: I've installed Rtools, MikTeX, perl, minGW, and HTML Help Workshop, and have succeeded in making, checking (using R CMD check mypkg) then building the simple example package.skeleton(list=c(f,g,d,e), name=mypkg) R CMD build mypkg produces a tarball. I don't know how to get a zip file. But when I try to Install package(s) from local zip files, I get this error message: Error in gzfile(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open compressed file 'mypkg/DESCRIPTION' But when I click on that file in the tarball it opens and shows me what I expected. I had hoped that I had weathered the hard part - building the package - but I still need some help: 1) How do I get a zipped file, rather than a tarball, 2) How do I install what I've built? Thanks in advance. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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@stat.math.ethz.ch 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] trouble loading example package
Greetings: I've installed Rtools, MikTeX, perl, minGW, and HTML Help Workshop, and have succeeded in making, checking (using R CMD check mypkg) then building the simple example package.skeleton(list=c(f,g,d,e), name=mypkg) R CMD build mypkg produces a tarball. I don't know how to get a zip file. But when I try to Install package(s) from local zip files, I get this error message: Error in gzfile(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open compressed file 'mypkg/DESCRIPTION' But when I click on that file in the tarball it opens and shows me what I expected. I had hoped that I had weathered the hard part - building the package - but I still need some help: 1) How do I get a zipped file, rather than a tarball, 2) How do I install what I've built? Thanks in advance. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] tcltk difficulties
Friends: I have a tcltk widget for inputting constants and other values that are needed by subsequent R functions. My widget works well. I have an OnOK function that does what I had hoped it would. Among other input items the widget also uses 6 radio buttons to select one of 6 choices. It functions as it should. Here is the problem: I would like one of the buttons to be the default and to be switched on when the widget is created so that the user will have some guidance. (Currently all 6 buttons are blank until one is selected.) I can't handle the job. I have Welch and Jones _Practical Programming in Tcl and Tk_ but would appreciate any help from fellow R users. Many thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] tcltk difficulties
Thank you, Peter. The code provides a great example of packing the widget nicely too. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Saturday, November 04, 2006 8:12 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] tcltk difficulties Charles Annis, P.E. [EMAIL PROTECTED] writes: Friends: I have a tcltk widget for inputting constants and other values that are needed by subsequent R functions. My widget works well. I have an OnOK function that does what I had hoped it would. Among other input items the widget also uses 6 radio buttons to select one of 6 choices. It functions as it should. Here is the problem: I would like one of the buttons to be the default and to be switched on when the widget is created so that the user will have some guidance. (Currently all 6 buttons are blank until one is selected.) I can't handle the job. I have Welch and Jones _Practical Programming in Tcl and Tk_ but would appreciate any help from fellow R users. library(tcltk) demo(tkdensity) # possibly: # options(pager=tkpager) file.show(system.file(demo/tkdensity.R,package=tcltk)) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] repeating symbols and colors
Heres an easy one. Well, easy for those more clever than I am. I am plotting several groups and use symbols 15:25, pch - 15:25 Sometimes, however, I need more than those and would like to have them recycled automatically so that pch[12] = pch[1]. Perhaps I can use %% or kludge up a multi-line, multi-if solution, but hope that a kind helper can suggest something more elegant. I am also using RColorBrewer and like Set1 but that has only 9 colors. I don't want infinitesimal color gradations and would prefer to re-use those colors if I can find a way to recycle them too. Since the number of available colors and available symbols differ, the color/symbol combinations will be unique for the recycled usage. Thanks for your counsel. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] exteremely confused (simple question)
You need to tell R that you mean Growth, the column in your data.frame. Otherwise R is looking for an external criterion named Growth. Try this: df[df$Growth0.5,] That means choose all columns for which df$Growth has a row value 0.5 df[df$Growth0.5,] IDKSurvGrowth Class 1 1 4808 0.86212 0.0066964 S 3 3 2084 0.93579 0.4407900 S Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Fonnesbeck Sent: Monday, October 30, 2006 7:48 PM To: r-help@stat.math.ethz.ch Subject: [R] exteremely confused (simple question) I thought I knew how to use data frames, but apparently not. I have created a data frame, and named the columns: df KSurv Growth Class 1 4808 0.86212 0.00669640 S 2 2430 0.98038 1.3054 S 3 2084 0.93579 0.44079000 S 4 2600 0.95394 2.0368 S 5 2143 0.96112 1.7833 S 6 4722 0.96682 6.3685 S 7 2639 0.94464 0.81887000 S 8 4906 0.96520 3.1004 S 9 1016 0.98993 1.6987 S 10 973 0.98137 1.4675 S ... etc. However, when I try to index a subset of this data frame, I get an error: df[Growth0.5] Error in [.data.frame(df, Growth 0.5) : object Growth not found Why on earth is it looking for a Growth object, when it is a column name in the data frame?? Extremely confused, -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 tcl/tk
Peter: Thank you for your response. I apologize for not sending a reproducible example. I have attached a reproducible example of the problem here. This is a much abbreviated version of my problem and even so it's rather long for an example. Run with tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) to turn the problem on and off. I have also attached a tcl.tk.example.txt file since these long inclusions within an R-help note often have the line feeds missing. Thank you for your insights. Charles Annis, P.E. ### tcl.tk.example - function(PROBLEM = TRUE) { require(tcltk) t2 - tktoplevel() tktitle(t2) - Hit/Miss group.button1 - tkradiobutton(t2) group.button2 - tkradiobutton(t2) repeated.measures.value - tclVar(3) l.repeated.measures.value - tklabel(t2, text= hit/miss column(s) ) e.repeated.measures.value - tkentry(t2, textvariable=repeated.measures.value, width=5, borderwidth = 3, relief=sunken) tkgrid(tklabel(t2, text=Hit/Miss POD Setup), columnspan=2, sticky=n) tkgrid.configure(l.repeated.measures.value, e.repeated.measures.value, sticky=e) tkgrid.configure(e.repeated.measures.value, sticky=w, padx=5) frame.2 - tkframe(t2, borderwidth = 3, width=150, height=100, relief=ridge) GROUP.column.value - tclVar(4) l.GROUP.column.value - tklabel(frame.2, text=GROUP column ) e.GROUP.column.value - tkentry(frame.2, textvariable=GROUP.column.value, width=2, borderwidth = 3, relief=sunken) l.group.value.yes - tklabel(frame.2, text=group data?yes ) l.group.value.no - tklabel(frame.2, text=NO ) group.buttonValue - tclVar(GROUP.DATA) tkconfigure(group.button1, variable=group.buttonValue, value=TRUE) tkconfigure(group.button2, variable=group.buttonValue, value=FALSE) if(PROBLEM){ ### group.button1 not placed within frame.2 because I don't know how to indicate frame.2 tkgrid(l.group.value.yes, group.button1, sticky=e) tkgrid(group.button1, sticky=w) tkgrid(l.group.value.no, group.button2, sticky=e) tkgrid(group.button2, sticky=w) } else { ### second dummy lable is correctly placed because I can tell it that it belongs in frame.2 tkgrid(l.group.value.yes, tklabel(frame.2, text=dummy), sticky=e) tkgrid(l.group.value.no, tklabel(frame.2, text=dummy), sticky=e) } tkgrid(l.GROUP.column.value, e.GROUP.column.value, sticky=e) tkgrid(e.GROUP.column.value, sticky=w, padx=5, pady=5) tkgrid(frame.2, columnspan=2) OnOK - function() { hit.miss.columns - eval(parse(text=paste(c(, substr(gsub(pattern = -, replacement=:, as.character(tclvalue(repeated.measures.value))),start=1,stop=1), n.columns - length(hit.miss.columns) GROUP.column - as.double(as.character(tclvalue(GROUP.column.value))) repeated.measures.GROUP.names - as.character(tclvalue(repeated.measures.GROUP.value)) ###read.hit.miss.input() tkdestroy(t2) } OK.but - tkbutton(t2,text= OK , command=OnOK, borderwidth = 3, relief=raised) tkgrid(tklabel(t2,text= Must click OK\nto register changes. ), (OK.but), sticky=e) tkgrid(OK.but, sticky=w) tkfocus(t2) } tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) ## Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Monday, October 23, 2006 3:35 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R tcl/tk Charles Annis, P.E. [EMAIL PROTECTED] writes: Friends: I am a long-time R user, learning tcl/tk, and am tying myself in knots over something that should be simple. I want to create a frame and put that frame inside the toplevel frame. This works (i.e. it places text in col 1, and the corresponding entry box in column 2) and later frame.2 resides where it should in the toplevel frame. tkgrid(tklabel(frame.2, text=FACTOR column ), tkentry(frame.2, textvariable=FACTOR.column.value, width=2), sticky=e) This doesn't work because I don't know how to tell tcl that answer.button1 belongs in frame2: tkconfigure(answer.button1, variable=buttonValue, value=TRUE) tkgrid(tklabel(frame.2, text=Question?yes ), answer.button1, sticky=e) ^^^ I know this can not be as hard as I am making it. Possibly, but there seems to be some context missing, so I can't quite grasp what you want to do. It does look a bit suspicious that you aren't saving the objects generated by tklabel and tkentry though. In general, the hierarchy between widgets is defined at widget creation time, so why is there no answer.button1 - tkbutton(frame.2,..whatever..) ? -- O__ Peter Dalgaard Øster Farimagsgade 5
Re: [R] R tcl/tk
D'oh! You are right of course. How very obvious these things are on the other side of the solution. I spent the entire weekend and completely missed it. Thanks! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Monday, October 23, 2006 9:48 AM To: [EMAIL PROTECTED] Cc: 'Peter Dalgaard'; r-help@stat.math.ethz.ch Subject: Re: [R] R tcl/tk Charles Annis, P.E. [EMAIL PROTECTED] writes: Peter: Thank you for your response. I apologize for not sending a reproducible example. I have attached a reproducible example of the problem here. This is a much abbreviated version of my problem and even so it's rather long for an example. Run with tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) ... group.button1 - tkradiobutton(t2) This would appear to be the problem. If you want button 1 to be a child of frame.2, use tkradiobutton(frame.2) (after creating the frame, of course) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R tcl/tk
Friends: I am a long-time R user, learning tcl/tk, and am tying myself in knots over something that should be simple. I want to create a frame and put that frame inside the toplevel frame. This works (i.e. it places text in col 1, and the corresponding entry box in column 2) and later frame.2 resides where it should in the toplevel frame. tkgrid(tklabel(frame.2, text=FACTOR column ), tkentry(frame.2, textvariable=FACTOR.column.value, width=2), sticky=e) This doesn't work because I don't know how to tell tcl that answer.button1 belongs in frame2: tkconfigure(answer.button1, variable=buttonValue, value=TRUE) tkgrid(tklabel(frame.2, text=Question?yes ), answer.button1, sticky=e) ^^^ I know this can not be as hard as I am making it. Thanks for the help. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R-2.4.0 and MS Vista OS - installing packages
I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install R is the only non-MS program running. I cannot install packages from CRAN, nor from local zipped files. (I have R-2.4.0 installed on a Windows XP machine and have had no problems so the difficulty seems to be Vista not R, however they aren't playing together nicely as they should.) The CRAN installation of R-2.4.0 on the Vista machine was without incident, but after downloading the zipped packages from CRAN I get this error message: utils:::menuInstallPkgs() trying URL 'http://cran.us.r-project.org/bin/windows/contrib/2.4/RColorBrewer_0.2-3.zip ' Content type 'application/zip' length 39787 bytes opened URL downloaded 38Kb Error in zip.unpack(pkg, tmpDir) : cannot open file 'C:/Program Files/R/R-2.4.0/library/file6fc97ac2/RColorBrewer/chtml/RColorBrewer.chm' Any help would be appreciated. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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-2.4.0 and MS Vista OS - installing packages
Problem solved! Thanks to all and especially Clint Bowman and Uwe Ligges who pointed to the fly in the ointment, viz. Vista's User Account Control, UAC. To allow installation of R packages, you must open the Vista Control Panel and choose Windows Security Center. Then turn the UAC off. This will require a restart of the computer. After the computer restarts and you summon R, packages can be installed from CRAN in the usual way. After installation you can reassert the UAC which also requires a computer restart. Vista starts up about 5X faster than my 3 year old Windows XP machine, so the restarts are not onerous. Many thanks to you all! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Clint Bowman Sent: Friday, October 20, 2006 4:59 PM To: Charles Annis, P.E. Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R-2.4.0 and MS Vista OS - installing packages This week's eweek has an article on Vista's security and system administration--I'm guessing (a Linux user guess) that you are running afoul of Vista's User Account Control feature. Clint BowmanINTERNET: [EMAIL PROTECTED] Air Dispersion Modeler INTERNET: [EMAIL PROTECTED] Air Quality Program VOICE: (360) 407-6815 Department of Ecology FAX:(360) 407-7534 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Fri, 20 Oct 2006, Charles Annis, P.E. wrote: I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install R is the only non-MS program running. I cannot install packages from CRAN, nor from local zipped files. (I have R-2.4.0 installed on a Windows XP machine and have had no problems so the difficulty seems to be Vista not R, however they aren't playing together nicely as they should.) The CRAN installation of R-2.4.0 on the Vista machine was without incident, but after downloading the zipped packages from CRAN I get this error message: utils:::menuInstallPkgs() trying URL 'http://cran.us.r-project.org/bin/windows/contrib/2.4/RColorBrewer_0.2-3.zip ' Content type 'application/zip' length 39787 bytes opened URL downloaded 38Kb Error in zip.unpack(pkg, tmpDir) : cannot open file 'C:/Program Files/R/R-2.4.0/library/file6fc97ac2/RColorBrewer/chtml/RColorBrewer.chm' Any help would be appreciated. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] avoiding a loop?
I have a vector, (not a list) repeated.measures.FACTOR.names [1] Insp1 Insp2 Insp3 Insp4 Insp5 Insp6 Insp7 Insp8 Insp9 and would like to convert this into a single string Insp1,Insp2,Insp3,Insp4,Insp5,Insp6,Insp7,Insp8,Insp9 I can do that with a loop, but isn't there a more elegant way? result - repeated.measures.FACTOR.names[[1]] for(i in 2:length(repeated.measures.FACTOR.names)) { result - paste(result, repeated.measures.FACTOR.names[[i]], sep=,) } result [1] Insp1,Insp2,Insp3,Insp4,Insp5,Insp6,Insp7,Insp8,Insp9 Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] impossible escape?
Greetings: I've searched the R archives with no luck. I want to print this to the screen as part of on-screen instructions as an example: default.FACTOR.labels - c(Probe1, Probe2, Probe3) I can't seem to trick gsub() gsub(', \, default.FACTOR.labels - c('Probe1', 'Probe2', 'Probe3'))) [1] default.FACTOR.labels - c(\Probe1\, \Probe2\, \Probe3\)) ^ ^ ^ ^ ^ ^ which gives me \ rather than Is it possible to escape the character? Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] FW: impossible escape?
D'oh! I've been using cat() but somehow never got the bigger picture. Thanks!!! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 11, 2006 1:45 PM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] impossible escape? On Wed, 2006-10-11 at 13:30 -0400, Charles Annis, P.E. wrote: Greetings: I've searched the R archives with no luck. I want to print this to the screen as part of on-screen instructions as an example: default.FACTOR.labels - c(Probe1, Probe2, Probe3) I can't seem to trick gsub() gsub(', \, default.FACTOR.labels - c('Probe1', 'Probe2', 'Probe3'))) [1] default.FACTOR.labels - c(\Probe1\, \Probe2\, \Probe3\)) ^ ^ ^ ^ ^ ^ which gives me \ rather than Is it possible to escape the character? Thanks. Charles Annis, P.E. You don't need the gsub() and you want to use cat() to output the text: cat(default.FACTOR.labels - c(\Probe1\, \Probe2\, \Probe3 \)\n) default.FACTOR.labels - c(Probe1, Probe2, Probe3) cat() will properly interpret and output the escaped characters. The newline character \n will return the cursor to the next line, so that the R prompt is not at the end of the last line output. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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] error in save.image
Greetings R-ians: Not infrequently of late I get this error message when trying to save what I'm working on. Error in save.image(C:/Documents and Settings/ ... /.RData) : image could not be renamed and is left in C:/Documents and Settings/ ... /.RDataTmp10 If I try again, it almost always is successful. I don't recall having had this situation earlier, but it does seem more frequent lately. Have others observed this? Could it be because my workspace has become large? (Large being relative: 660KB) I'm using Version 2.3.1 (2006-06-01) running Windows XP on a Dell with 2Meg. Thanks. Charles Annis, P.E. PS - Yes, I have upgraded to R version 2.4.0 (2006-10-03) but do not want to change in the middle of a project. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] GLM information matrix
David: I don't have what you want. But if your model is simple (2-parameter, binomial response, glm with a logit link) I have some code that computes and plots the loglikelihood surface using contour() and superimposes the asymptotic 95% confidence ellipse, for comparison with the observed contour for qchisq(0.95, df=2)/2. And for many datasets the agreement isn't as nice as you might hope, and that your Hessian might require. (That is, the actually contour is not elliptical, or if it is its axes may not agree well with the pseudo-elliptical contour of the observed loglikelihood surface.) You may be looking for the resulting confidence bounds on the glm fit for which I also have code that iteratively interrogates the loglikelihood surface without plotting it. If any of this is interesting, please send me a note so we won't clog the bandwidth. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bickel, David Sent: Friday, September 29, 2006 1:50 PM To: r-help@stat.math.ethz.ch Subject: [R] GLM information matrix Is there a function that provides the Fisher information matrix for a generalized linear model? I do not see how to access the off-diagonal matrix elements of the value returned by glm. (I'm particularly interested in logistic regression.) If not, what is a good way to use R to compute Hessians or other partial derivatives of log likelihoods? I would appreciate any guidance. David ___ David R. Bickel http://davidbickel.com Research Scientist Pioneer Hi-Bred International (DuPont) Bioinformatics 7200 NW 62nd Ave.; PO Box 184 Johnston, IA 50131-0184 515-334-4739 Tel 515-334-4473 Fax [EMAIL PROTECTED] This communication is for use by the intended recipient and ...{{dropped}} __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] control L to clear the Rgui screen in Windows
Greetings R-ians: Searching the Searchable Mail Archives I discovered that ctrl L will clear the Rgui screen, which is what I'd like to do from a print (or some similar) statement. Is there a mechanism to use the ctrl L clear-screen sequence in a script, or print statement? Thanks for your counsel. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] SUMMARY control L to clear the Rgui screen in Windows
Eternal thanks to Jim Holtman and to Gabor Grothendieck who pointed me to this concise piece of code: cls - function() { require(rcom) wsh - comCreateObject(Wscript.Shell) comInvoke(wsh, SendKeys, \014) invisible(wsh) } Perfect! Thanks! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Thursday, September 28, 2006 10:13 PM To: R-help@stat.math.ethz.ch Subject: [R] control L to clear the Rgui screen in Windows Greetings R-ians: Searching the Searchable Mail Archives I discovered that ctrl L will clear the Rgui screen, which is what I'd like to do from a print (or some similar) statement. Is there a mechanism to use the ctrl L clear-screen sequence in a script, or print statement? Thanks for your counsel. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] t-stat Curve
Isaac: You will likely find something helpful here: http://addictedtor.free.fr/graphiques/thumbs.php I also recently came across this code (I thought it was at the URL above, but I can't find it now) that may be useful with modification. I apologize to the code-writer for having lost the correct reference. (If anyone finds it, please send the reference to me. Thanks.) # # neighboring (not overlapping) normal densities dev.off() x-seq(-10,10,length=400) y1-dnorm(x) y2-dnorm(x,m=3) par(mar=c(5,4,2,1)) plot(x, y2, xlim=c(-3,8), type=n, xlab=quote(Z==frac(mu[1]-mu[2], sigma/sqrt(n))), ylab=Density) polygon(c(1.96,1.96,x[240:400],10), c(0,dnorm(1.96,m=3),y2[240:400],0), col=grey80, lty=0) lines(x, y2) lines(x, y1) polygon(c(-1.96,-1.96,x[161:1],-10), c(0,dnorm(-1.96,m=0), y1[161:1],0), col=grey30, lty=0) polygon(c(1.96, 1.96, x[240:400], 10), c(0,dnorm(1.96,m=0), y1[240:400],0), col=grey30) legend(4.2, .4, fill=c(grey80,grey30), legend=expression(P(abs(phantom(i)*Z*phantom(i))1.96, H[1])==0.85, P(abs(phantom(i)*Z*phantom(i))1.96,H[0])==0.05), bty=n) text(0, .2, quote(H[0]:~~mu[1]==mu[2])) text(3, .2, quote(H[1]:~~mu[1]==mu[2]+delta)) # Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Isaac Barjis Sent: Wednesday, September 27, 2006 11:08 AM To: R-help@stat.math.ethz.ch Subject: [R] t-stat Curve Number of subjects = 25 Mean of Sample = 77 Standard Deviation (s) = 12 sem = 2.4 df = 24 The claim is that population mean is less than 80 * 80 So our H0 (null hupotheis) is * 80 qt(.95,24) [1] 1.710882 qt(0.05, 24) [1] -1.710882 tstat = -1.25 on t24 falls between 1.711 (.95,24) and *1.711 (.005,24) How Could I sketch t curve for the above data where my * would be at the center? Best Regards Isaac Dr. I. Barjis Assistant Professor Summer and Evening Coordinator Department of Biological Sciences Room P313 300 Jay Street Brooklyn, NY 11201 Phone: (718)2605285 Fax: (718)2548680 Fax: (718) 254-8595 Department Office http://websupport1.citytech.cuny.edu/Faculty/ibarjis __ R-help@stat.math.ethz.ch 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] Statitics Textbook - any recommendation?
Recommending a good book on statistics is like recommending a good book on sports: Which sports? A good book for learning statistical concepts (and learning R at the same time), one that assumes you understand algebra but are new to statistics, is Peter Dalgaard's _Introductory Statistics with R_ (Springer 2002). The writing is relaxed and succinct, not condescending as some texts might appear to a newcomer. It's just a good book. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Nielsen Sent: Wednesday, September 20, 2006 6:36 PM To: Berton Gunter Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Statitics Textbook - any recommendation? Excellent characterization. MASS is a very good book, but I'm not sure I would describe it as a statistics textbook, much less one of the basic variety. While I certainly wouldn't presume to speak for Prof. Ripley and Dr. Venables, it seems unlikely their intent in writing MASS was to teach statistics, but rather, as the name of the book might suggest, to explain how S+ (and R) can be applied to modern statistical techniques. My experience with this book is that it assumes considerable background knowledge. By all means, buy MASS, but if you need guidance on the how and why of statistical techniques, you may wish to shop Amazon to find a supplement. Regards, Mike On 9/20/06, Berton Gunter [EMAIL PROTECTED] wrote: Not withstanding Prof. Heiberger's admirable enthusiasm, I think the canonical answer is probably MASS (Modern Applied Statistics with S) by Venables and Ripley. It is very comprehensive, but depending on your background, you may find it too telegraphic. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iuri Gavronski Sent: Wednesday, September 20, 2006 1:22 PM To: r-help@stat.math.ethz.ch Subject: [R] Statitics Textbook - any recommendation? I would like to buy a basic statistics book (experimental design, sampling, ANOVA, regression, etc.) with examples in R. Or download it in PDF or html format. I went to the CRAN contributed documentation, but there were only R textbooks, that is, textbooks where R is the focus, not the statistics. And I would like to find the opposite. Other text I am trying to find is multivariate data analysis (EFA, cluster, mult regression, MANOVA, etc.) with examples with R. Any recommendation? Thank you in advance, Iuri. __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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. -- Regards, Mike Nielsen __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] acos(0.5) == pi/3 FALSE
How close do you think it should be, given finite resolution with digital computing? acos(0.5) - pi/3 [1] 2.220446e-16 Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iñaki Murillo Arcos Sent: Monday, September 18, 2006 1:32 PM To: r-help@stat.math.ethz.ch Subject: [R] acos(0.5) == pi/3 FALSE Hello, I don't know if the result of acos(0.5) == pi/3 is a bug or not. It looks strange to me. Inaki Murillo __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Standard error of coefficient in linear regression
An easier way is to use summary() summary(lmfit) or summary(lmfit)$coefficients Estimate Std. Error t value Pr(|t|) (Intercept) 9.872541 5.2394254 1.884279 0.13262386 exped 3.681715 0.9294818 3.961040 0.01666313 or summary(lmfit)$coefficients[,2] (Intercept) exped 5.2394254 0.9294818 Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitrios Rizopoulos Sent: Sunday, September 17, 2006 3:13 PM To: Maciej Bliziński Cc: R - help Subject: Re: [R] Standard error of coefficient in linear regression these standard errors and other quantities are calculated as by products of the QR decomposition used in lm.fit(). A simple way (but not efficient) to obtain them is: exped - c(4.2, 6.1, 3.9, 5.7, 7.3, 5.9) sales - c(27.1, 30.4, 25.0, 29.7, 40.1, 28.8) S - data.frame(exped, sales) lmfit - lm(sales ~ exped, data = S) X - model.matrix(lmfit) sigma2 - sum((sales - fitted(lmfit))^2) / (nrow(X) - ncol(X)) sqrt(sigma2) sqrt(diag(solve(crossprod(X))) * sigma2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting Maciej Bliziński [EMAIL PROTECTED]: Hello R users, I have a substantial question about statistics, not about R itself, but I would love to have an answer from an R user, in form of an example in R syntax. I have spent whole Sunday searching in Google and browsing the books. I've been really close to the answer but there are at least three standard errors you can talk about in the linear regression and I'm really confused. The question is: How exactly are standard errors of coefficients calculated in the linear regression? Here's an example from a website I've read [1]. A company wants to know if there is a relationship between its advertising expenditures and its sales volume. exped - c(4.2, 6.1, 3.9, 5.7, 7.3, 5.9) sales - c(27.1, 30.4, 25.0, 29.7, 40.1, 28.8) S - data.frame(exped, sales) summary(lm(sales ~ exped, data = S)) Call: lm(formula = sales ~ exped, data = S) Residuals: 1 2 3 4 5 6 1.7643 -1.9310 0.7688 -1.1583 3.3509 -2.7947 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 9.8725 5.2394 1.884 0.1326 exped 3.6817 0.9295 3.961 0.0167 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.637 on 4 degrees of freedom Multiple R-Squared: 0.7968, Adjusted R-squared: 0.7461 F-statistic: 15.69 on 1 and 4 DF, p-value: 0.01666 I can calculate the standard error of the estimate, according to the equation [2]... S.m - lm(sales ~ exped, data = S) S$pred - predict(S.m) S$ye - S$sales - S$pred S$ye2 - S$ye ^ 2 Se - sqrt(sum(S$ye2)/(length(S$sales) - 1 - 1)) Se [1] 2.636901 ...which matches the Residual standard error and I'm on the right track. Next step would be to use the equation [3] to calculate the standard error of the regression coefficient (here: exped). The equation [3] uses two variables, meaning of which I can't really figure out. As the calculated value Sb is scalar, all the parameters need also to be scalars. I've already calculated Se, so I'm missing x and \bar{x}. The latter could be the estimated coefficient. What is x then? Regards, Maciej [1] http://www.statpac.com/statistics-calculator/correlation-regression.htm [2] http://www.answers.com/topic/standard-error-of-the-estimate [3] http://www.answers.com/topic/standard-error-of-the-regression-coefficient -- Maciej Bliziński [EMAIL PROTECTED] http://automatthias.wordpress.com __ R-help@stat.math.ethz.ch 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. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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
Re: [R] .Rprofile under Windoze.
Under Windows mine is located here C:\Program Files\R\R-2.3.1\library\base\R The file name, however is not .Rprofile, but rather Rprofile Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner Sent: Wednesday, August 30, 2006 5:50 PM To: r-help@stat.math.ethz.ch Subject: [R] .Rprofile under Windoze. I am (for my sins) having to do some work using R under Windoze. I wanted to set up a .Rprofile to control my set-up. The docs on .Rprofile say that it can/should be placed in ``the user's home directory''. ``An Introduction to R'' observes lucidly that this concept needs to be clarified under Windoze. Following the suggestions in An Introduction to R, I tried putting a .Rprofile in C:\Documents and Settings\rolf\My Documents When that didn't work, I tried putting it in the starting directory (and confirmed that I'd got that right by checking with getwd() and list.files(all.files=TRUE) ). The last invocation indicated that the name of the file was *really* ``.Rprofile.txt'' --- although I'd tried to save it as (simply) ``.Rprofile''. Is that the problem? If so, how can I persuade Windoze NOT to stick that damned .txt tag on the end? (Gawd, but I ***hate*** Windoze!!!) If that's not the problem, can you suggest what *is* the problem? All that .Rprofile(.txt) has in it at the moment is options(prompt=Wheee! ) so that I can easily tell whether it's working. If I execute source(.Rprofile.txt) the prompt does indeed get changed to ``Wheee! '' as it should. I would appreciate enlightenment. Ta. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] screen resolution effects on graphics
Greetings, R-Citizens: I have the good fortune of working with a 19 1280 X 1024 pixel monitor. My R-code produces nice-looking graphics on this machine but the same code results in crowded plots on an older machine with 800 X 600 resolution. In hindsight this seems obvious, but I didn't anticipate it. My code will be used on machines with varying graphics (and memory) capacity. Is there a way I can check the native resolution of the machine so that I can make adjustments to my code for the possible limitations of the machine running it? Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] screen resolution effects on graphics
My apologies for my oversight. I am using WindowsXP. The code that produces a nice-looking jpg (when viewed on my screen) produces cramped graphics on a 800 X 600 screen. I can change the spacings on the plot and remedy the situation for 800 X 600, but that looks awkward at 1280 X 1024. Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Monday, August 28, 2006 10:55 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics You forgot to mention your OS. This was asked before and if I recall correctly the answer for Windows was no. An acceptable solution (imho) is to edit the Rprofile.site files and add something like pngplotwidth - 990 ; pngplotheight - 700 pdfplotwidth - 14 ; pdfplotheight - 10 Then, use these values in your functions. It's manual, but you only need to do this once for each machine. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Monday, August 28, 2006 8:50 AM To: r-help@stat.math.ethz.ch Subject: [R] screen resolution effects on graphics Greetings, R-Citizens: I have the good fortune of working with a 19 1280 X 1024 pixel monitor. My R-code produces nice-looking graphics on this machine but the same code results in crowded plots on an older machine with 800 X 600 resolution. In hindsight this seems obvious, but I didn't anticipate it. My code will be used on machines with varying graphics (and memory) capacity. Is there a way I can check the native resolution of the machine so that I can make adjustments to my code for the possible limitations of the machine running it? Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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@stat.math.ethz.ch 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] screen resolution effects on graphics
Gabor: I am afraid I am demonstrating my lack of computer savvy. As you instructed, I downloaded the code, saved it as the file you suggested, and executed this within R as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) The DOS window opened, some magic occurred in the blink of an eye, and the DOS window closed. I haven't the foggiest idea what to do next since I can see no evidence of having done anything. Thanks for your patience. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Monday, August 28, 2006 11:39 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics 1. Put the code from www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0721.mspx into, say, \bin\displayconfiguration.vbs, and then from R do this: as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) or we can translate that into R to eliminate the need for a vbs routine and then run it directly from R (although we will still need the indicated dll): # must have GenericEnum.dll registered. That is, download and unzip: # http://sunsite.univie.ac.at/rcom/download/GenericEnum.zip # and register it: regsvr32 GenericEnum.dll library(RDCOMClient) strComputer = . SWBemlocator - COMCreate(WbemScripting.SWbemLocator) objWMIService - SWBemlocator$ConnectServer(strComputer,\\root\\CIMV2) colItems - objWMIService$ExecQuery (Select * from Win32_DisplayConfiguration) lEnum - COMCreate(GenericEnum.AutomationEnum) lEnum[[Collection]] - colItems if (lEnum$SetFirst()) { repeat { cat(lEnum[[Item]][[DeviceName]], \n) cat(lEnum[[Item]][[BitsPerPel]], \n) cat(lEnum[[Item]][[Pelswidth]], \n) cat(lEnum[[Item]][[Pelsheight]], \n) if (!lEnum$SetNext()) break } } On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: My apologies for my oversight. I am using WindowsXP. The code that produces a nice-looking jpg (when viewed on my screen) produces cramped graphics on a 800 X 600 screen. I can change the spacings on the plot and remedy the situation for 800 X 600, but that looks awkward at 1280 X 1024. Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Monday, August 28, 2006 10:55 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics You forgot to mention your OS. This was asked before and if I recall correctly the answer for Windows was no. An acceptable solution (imho) is to edit the Rprofile.site files and add something like pngplotwidth - 990 ; pngplotheight - 700 pdfplotwidth - 14 ; pdfplotheight - 10 Then, use these values in your functions. It's manual, but you only need to do this once for each machine. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Monday, August 28, 2006 8:50 AM To: r-help@stat.math.ethz.ch Subject: [R] screen resolution effects on graphics Greetings, R-Citizens: I have the good fortune of working with a 19 1280 X 1024 pixel monitor. My R-code produces nice-looking graphics on this machine but the same code results in crowded plots on an older machine with 800 X 600 resolution. In hindsight this seems obvious, but I didn't anticipate it. My code will be used on machines with varying graphics (and memory) capacity. Is there a way I can check the native resolution of the machine so that I can make adjustments to my code for the possible limitations of the machine running it? Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
Re: [R] screen resolution effects on graphics
This is what happened here: ls() character(0) as.numeric(gsub(.* , , grep(resolution, + shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) numeric(0) ls() character(0) Nothing displayed; nothing created. But the DOS window DID open and something happened, but I don't know what. Agin thanks for your patience. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 2:21 PM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics This is what happens when I run it in R 2.3.1: as.numeric(gsub(.* , , grep(resolution, + shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), + value = TRUE))) [1] 1280 1024 The result is obviously dependent on your particular video card (I have a radeon). Try running it from outside of R and see what you get: cd \bin cscript displayconfiguration.vbs Also make sure you copied the code correctly from the web site and also try the second solution too just in case. Its possible that virus detection software will interfere since some antivirus programs prevent all vbscript routines from running. On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: Gabor: I am afraid I am demonstrating my lack of computer savvy. As you instructed, I downloaded the code, saved it as the file you suggested, and executed this within R as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) The DOS window opened, some magic occurred in the blink of an eye, and the DOS window closed. I haven't the foggiest idea what to do next since I can see no evidence of having done anything. Thanks for your patience. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Monday, August 28, 2006 11:39 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics 1. Put the code from www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0721.mspx into, say, \bin\displayconfiguration.vbs, and then from R do this: as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) or we can translate that into R to eliminate the need for a vbs routine and then run it directly from R (although we will still need the indicated dll): # must have GenericEnum.dll registered. That is, download and unzip: # http://sunsite.univie.ac.at/rcom/download/GenericEnum.zip # and register it: regsvr32 GenericEnum.dll library(RDCOMClient) strComputer = . SWBemlocator - COMCreate(WbemScripting.SWbemLocator) objWMIService - SWBemlocator$ConnectServer(strComputer,\\root\\CIMV2) colItems - objWMIService$ExecQuery (Select * from Win32_DisplayConfiguration) lEnum - COMCreate(GenericEnum.AutomationEnum) lEnum[[Collection]] - colItems if (lEnum$SetFirst()) { repeat { cat(lEnum[[Item]][[DeviceName]], \n) cat(lEnum[[Item]][[BitsPerPel]], \n) cat(lEnum[[Item]][[Pelswidth]], \n) cat(lEnum[[Item]][[Pelsheight]], \n) if (!lEnum$SetNext()) break } } On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: My apologies for my oversight. I am using WindowsXP. The code that produces a nice-looking jpg (when viewed on my screen) produces cramped graphics on a 800 X 600 screen. I can change the spacings on the plot and remedy the situation for 800 X 600, but that looks awkward at 1280 X 1024. Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Monday, August 28, 2006 10:55 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics You forgot to mention your OS. This was asked before and if I recall correctly the answer for Windows was no. An acceptable solution (imho) is to edit the Rprofile.site files and add something like pngplotwidth - 990 ; pngplotheight - 700 pdfplotwidth - 14 ; pdfplotheight - 10 Then, use these values in your functions. It's manual, but you only need to do this once for each machine. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Monday, August 28, 2006 8:50 AM To: r-help@stat.math.ethz.ch Subject: [R] screen resolution effects on graphics Greetings, R-Citizens: I have the good fortune of working
Re: [R] screen resolution effects on graphics
Using sub rather than gsub appears to have no effect. The DOS window opens, then closes having had no noticeable effect. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 2:27 PM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics One other idea. Replace gsub with sub and see if that helps. Maybe the output from the video driver has spaces in it. On 8/28/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: This is what happens when I run it in R 2.3.1: as.numeric(gsub(.* , , grep(resolution, + shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), + value = TRUE))) [1] 1280 1024 The result is obviously dependent on your particular video card (I have a radeon). Try running it from outside of R and see what you get: cd \bin cscript displayconfiguration.vbs Also make sure you copied the code correctly from the web site and also try the second solution too just in case. Its possible that virus detection software will interfere since some antivirus programs prevent all vbscript routines from running. On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: Gabor: I am afraid I am demonstrating my lack of computer savvy. As you instructed, I downloaded the code, saved it as the file you suggested, and executed this within R as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) The DOS window opened, some magic occurred in the blink of an eye, and the DOS window closed. I haven't the foggiest idea what to do next since I can see no evidence of having done anything. Thanks for your patience. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Monday, August 28, 2006 11:39 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics 1. Put the code from www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0721.mspx into, say, \bin\displayconfiguration.vbs, and then from R do this: as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) or we can translate that into R to eliminate the need for a vbs routine and then run it directly from R (although we will still need the indicated dll): # must have GenericEnum.dll registered. That is, download and unzip: # http://sunsite.univie.ac.at/rcom/download/GenericEnum.zip # and register it: regsvr32 GenericEnum.dll library(RDCOMClient) strComputer = . SWBemlocator - COMCreate(WbemScripting.SWbemLocator) objWMIService - SWBemlocator$ConnectServer(strComputer,\\root\\CIMV2) colItems - objWMIService$ExecQuery (Select * from Win32_DisplayConfiguration) lEnum - COMCreate(GenericEnum.AutomationEnum) lEnum[[Collection]] - colItems if (lEnum$SetFirst()) { repeat { cat(lEnum[[Item]][[DeviceName]], \n) cat(lEnum[[Item]][[BitsPerPel]], \n) cat(lEnum[[Item]][[Pelswidth]], \n) cat(lEnum[[Item]][[Pelsheight]], \n) if (!lEnum$SetNext()) break } } On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: My apologies for my oversight. I am using WindowsXP. The code that produces a nice-looking jpg (when viewed on my screen) produces cramped graphics on a 800 X 600 screen. I can change the spacings on the plot and remedy the situation for 800 X 600, but that looks awkward at 1280 X 1024. Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Monday, August 28, 2006 10:55 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics You forgot to mention your OS. This was asked before and if I recall correctly the answer for Windows was no. An acceptable solution (imho) is to edit the Rprofile.site files and add something like pngplotwidth - 990 ; pngplotheight - 700 pdfplotwidth - 14 ; pdfplotheight - 10 Then, use these values in your functions. It's manual, but you only need to do this once for each machine. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Monday, August 28, 2006 8:50 AM To: r-help@stat.math.ethz.ch Subject: [R] screen resolution effects
Re: [R] screen resolution effects on graphics
Gabor: Success! (Sort of) Running outside R in the DOS window produces C:\Program Files\R\R-2.3.1\bincscript displayconfiguration.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Name: NVIDIA GeForce FX 5200 Color depth: 32 Horizontal resolution: 1280 Vertical resolution: 1024 I don't have immediate access to a machine with 800X600 native resolution so I can't compare. What's next? The problem isn't that a jpg produced on this machine looks crowed on an 800 X 600 machine. It's that the same R code on this machine generates a crowded jpeg on the older machine. My hope was to check the capability of the current machine and make some modest adjustments to my R code to produce an acceptable jpg on any machine running it. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Monday, August 28, 2006 2:21 PM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics This is what happens when I run it in R 2.3.1: as.numeric(gsub(.* , , grep(resolution, + shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), + value = TRUE))) [1] 1280 1024 The result is obviously dependent on your particular video card (I have a radeon). Try running it from outside of R and see what you get: cd \bin cscript displayconfiguration.vbs Also make sure you copied the code correctly from the web site and also try the second solution too just in case. Its possible that virus detection software will interfere since some antivirus programs prevent all vbscript routines from running. On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: Gabor: I am afraid I am demonstrating my lack of computer savvy. As you instructed, I downloaded the code, saved it as the file you suggested, and executed this within R as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) The DOS window opened, some magic occurred in the blink of an eye, and the DOS window closed. I haven't the foggiest idea what to do next since I can see no evidence of having done anything. Thanks for your patience. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Monday, August 28, 2006 11:39 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics 1. Put the code from www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0721.mspx into, say, \bin\displayconfiguration.vbs, and then from R do this: as.numeric(gsub(.* , , grep(resolution, shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE), value = TRUE))) or we can translate that into R to eliminate the need for a vbs routine and then run it directly from R (although we will still need the indicated dll): # must have GenericEnum.dll registered. That is, download and unzip: # http://sunsite.univie.ac.at/rcom/download/GenericEnum.zip # and register it: regsvr32 GenericEnum.dll library(RDCOMClient) strComputer = . SWBemlocator - COMCreate(WbemScripting.SWbemLocator) objWMIService - SWBemlocator$ConnectServer(strComputer,\\root\\CIMV2) colItems - objWMIService$ExecQuery (Select * from Win32_DisplayConfiguration) lEnum - COMCreate(GenericEnum.AutomationEnum) lEnum[[Collection]] - colItems if (lEnum$SetFirst()) { repeat { cat(lEnum[[Item]][[DeviceName]], \n) cat(lEnum[[Item]][[BitsPerPel]], \n) cat(lEnum[[Item]][[Pelswidth]], \n) cat(lEnum[[Item]][[Pelsheight]], \n) if (!lEnum$SetNext()) break } } On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: My apologies for my oversight. I am using WindowsXP. The code that produces a nice-looking jpg (when viewed on my screen) produces cramped graphics on a 800 X 600 screen. I can change the spacings on the plot and remedy the situation for 800 X 600, but that looks awkward at 1280 X 1024. Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Monday, August 28, 2006 10:55 AM To: [EMAIL PROTECTED] Cc: r-help Subject: Re: [R] screen resolution effects on graphics You forgot to mention your OS. This was asked before and if I recall correctly the answer for Windows was no. An acceptable solution (imho) is to edit the Rprofile.site files and add something like pngplotwidth - 990
Re: [R] screen resolution effects on graphics
Romain: a - tempfile() cat('htmlscript type=text/javascript document.write(screen.width) ; /script/html', file=a) browseURL(a) The object a was created, but no browser opened. ls() [1] a a [1] C:\\DOCUME~1\\CHARLE~1\\LOCALS~1\\Temp\\RtmpRgWrqb\\file678418be Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Romain Francois Sent: Monday, August 28, 2006 2:30 PM To: Prof Brian Ripley Cc: Charles Annis, P.E.; r-help@stat.math.ethz.ch Subject: Re: [R] screen resolution effects on graphics Prof Brian Ripley a écrit : On Mon, 28 Aug 2006, Charles Annis, P.E. wrote: Greetings, R-Citizens: I have the good fortune of working with a 19 1280 X 1024 pixel monitor. My (Similar to our student lab has used for many years.) R-code produces nice-looking graphics on this machine but the same code results in crowded plots on an older machine with 800 X 600 resolution. In hindsight this seems obvious, but I didn't anticipate it. It is not obvious to me: I have never experienced it. What OS and graphics device is this? Almost all of R's graphics is independent of the screen resolution (the exception being the bitmapped devices such as jpeg), with things sized in inches or points. My machines are 1600x1200 (apart from 1280x800 on my laptop), so I meet a considerable reduction when using a computer projector, and my plots do not look crowded. However, one issue is when the OS has a seriously incorrect setting for the screen resolution and so does not give the sizes asked for by R. We have seen that on both Linux and Windows, and the windows() device has arguments to set the correct values. (On X11 you should be able to set this in Xconfig files.) If this is Windows, check carefully the description of the initial screen size in ?windows. That can have unexpected effects on physically small screens. At one time the X11() device was set up to assume 75dpi unless the reported resolution was 100+/-0.5dpi. My then monitor reported 99.2 dpi and so things came out at 3/4 of the intended size. We fixed that quite a while back. My code will be used on machines with varying graphics (and memory) capacity. Is there a way I can check the native resolution of the machine so that I can make adjustments to my code for the possible limitations of the machine running it? Only via C code, which is how R does it. Hi, Javascript knows, can we ask him ? I mean, if I do that in R : a - tempfile() cat('htmlscript type=text/javascript document.write(screen.width) ; /script/html', file=a) browseURL(a) I get 1920 in my browser's window. Can R read it ? Romain __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] help with pasting + expressions?
Please visit the R site http://www.r-project.org/ and search the mailing list for paste expression We discussed the topic recently. The trick is that you don't paste expressions, you make an expression containing paste. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff D. Hamann Sent: Wednesday, August 23, 2006 11:02 PM To: r-help@stat.math.ethz.ch Subject: [R] help with pasting + expressions? I can't believe I'm having such a hard time with this and I haven't been able to find out how to solve this... lab - expression( paste( hat(v), as.character(round(y.hat,2)), ,, hat(sigma)^2, as.character(sigma.hat)) ) text( x=pt$x+2, y=pt$y,labels=lab ) ## the text should be \hat{y} = value of y.hat, \hat{\sigma}^2 == value of sigma.hat and R keeps displaying the actual text of the non-expressions... I must be a chowderhead, but I need a little guidance, please... Thanks, Jeff. -- Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] string-to-number
Greetings, Amigos: I have been trying without success to convert a character string, repeated.measures.columns [1] 3,6,10 into c(3,6,10) for subsequent use. as.numeric(repeated.measures.columns) doesn't work (likely because of the commas) [1] NA Warning message: NAs introduced by coercion I've tried many things including strsplit(repeated.measures.columns, split = ,) which produces a list with only one element, viz: [[1]] [1] 3 6 10 as.numeric() doesn't like that either. Clearly: 1) I cannot be the first person to attempt this, and 2) I've made this WAY harder than it is. Would some kind soul please instruct me (and perhaps subsequent searchers) how to convert the elements of a string into numbers? Thank you. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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] string-to-number SUMMARY
Much gratitude to Professor Ripley, Peter Dalgaard, Marc Schwartz, and Roger Bivand. __ Roger Bivand wrote that ... strsplit() returns a list - one list component for each repeated.measures.columns element. Just pick off the one you want with [[]]: as.numeric(strsplit(repeated.measures.columns, split = ,)[[1]]) which had stumped me, since that syntax fails without the [[1]] specification. __ Peter Dalgaard, who also suggested the [[1]] specification, pointed out that scan(textConnection(x), sep=,) will work, although that leaves you with a dangling open connection. __ Marc Schwartz advised to ... Use unlist() to take the output of strsplit() and convert it to a vector, before coercing to numeric. as.numeric(unlist(strsplit(repeated.measures.columns, ,))) Brian D. Ripley suggested that the following looks competitive, and is quite a bit more general (e.g. allows spaces, works with complex numbers) eval(parse(text=paste(c(, repeated.measures.columns, and Marc Schwartz showed that Professor Ripley's suggestion is much faster than the competition with some system.time trials. Many thanks to all. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Saturday, August 19, 2006 7:59 AM To: r-help@stat.math.ethz.ch Subject: [R] string-to-number Greetings, Amigos: I have been trying without success to convert a character string, repeated.measures.columns [1] 3,6,10 into c(3,6,10) for subsequent use. as.numeric(repeated.measures.columns) doesn't work (likely because of the commas) [1] NA Warning message: NAs introduced by coercion I've tried many things including strsplit(repeated.measures.columns, split = ,) which produces a list with only one element, viz: [[1]] [1] 3 6 10 as.numeric() doesn't like that either. Clearly: 1) I cannot be the first person to attempt this, and 2) I've made this WAY harder than it is. Would some kind soul please instruct me (and perhaps subsequent searchers) how to convert the elements of a string into numbers? Thank you. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] greek letters, text, and values in labels
This'll work. theta - 2.1 plot(NA, xlim=c(0,1), ylim=c(0,1), xlab=bquote(theta == .(theta)), ylab=bquote(theta == .(theta)), main=bquote(paste(Results for ,theta == .(theta Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adrian Dragulescu Sent: Tuesday, July 25, 2006 4:12 PM To: r-help@stat.math.ethz.ch Subject: [R] greek letters, text, and values in labels Hello, I want to have a title that will look something like: Results for \theta=2.1, given that I have a variable theta=2.1, and \theta should show on the screen like the greek letter. I've tried a lot of things: theta - 2.1 plot(1:10, main=expression(paste(Results for, theta, =, eval(theta or using bquote plot(1:10, main=paste(Results for , bquote(theta == .(theta or using substitute, etc. I could not make it work. This should be easy. I would appreciate your help. Thanks, Adrian __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] saving intermediate graphics
Greetings, R-friends: I'm using R 2.3.1 on a DELL box with 2 gig, running WindowsXP Pro. I am making what is admittedly a very busy plot composed of qq plots with superimposed density() plots. I need to show everything and the result is messy, but informative. If I produce the basic qq plot, and then add incrementally to it, saving the graphic at each step, the sequence does make the entire exercise understandable. (Honest!) I can do this easily by clicking on the plot and saving it to PowerPoint as a metafile. I would like to automate the process. I know how to produce win.metafiles, but closing the file with dev.off() to produce the first graphic means that I can't add to that and produce the subsequent graphic and file. Is there a way to do this without generating the entire plot from the beginning for each graphic? Thanks Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] saving intermediate graphics
Wow! Exactly what I needed. Thank you, Professor Ripley! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Wednesday, July 12, 2006 3:01 PM To: Charles Annis, P.E. Cc: r-help@stat.math.ethz.ch Subject: Re: [R] saving intermediate graphics On Wed, 12 Jul 2006, Charles Annis, P.E. wrote: Greetings, R-friends: I'm using R 2.3.1 on a DELL box with 2 gig, running WindowsXP Pro. I am making what is admittedly a very busy plot composed of qq plots with superimposed density() plots. I need to show everything and the result is messy, but informative. If I produce the basic qq plot, and then add incrementally to it, saving the graphic at each step, the sequence does make the entire exercise understandable. (Honest!) I can do this easily by clicking on the plot and saving it to PowerPoint as a metafile. I would like to automate the process. I know how to produce win.metafiles, but closing the file with dev.off() to produce the first graphic means that I can't add to that and produce the subsequent graphic and file. Is there a way to do this without generating the entire plot from the beginning for each graphic? Have you tried savePlot()? It should work incrementally. -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] string problems with \\ (Windows)
Greetings, R-ians: I'm using R 2.3.1 on WindowsXP. I need to find the name of a file at the end of a sting that contains the path + file, with the problematic \\ as separators. The string looks something like this: C:\\Documents and Settings\\myName\\My Documents\\R Projects\\Project1\\file.name.csv What I want is file.name.csv Currently I use the name of the project as the splitter in strsplit(string.name, split=Project1, extended = FALSE) This works, of course, but I won't always be using folder Project1, so I need a more universal way to find the name of a file at the end of a string with \\ separators. Can I get there from here? (I've looked through previous R-help listing of similar problems but if it's there, I missed it.) Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] another tcl/tk query
Greetings: I wish to use a tcl/tk widget to ask for user-selected parameter values. My widget works it asks for and returns to my workspace the stuff I need. Here is a snippet of my code: ### OnOK - function() { LOG.X - as.logical(as.character(tclvalue(log.X.buttonValue))) LOG.Y - as.logical(as.character(tclvalue(log.Y.buttonValue))) natural.units.â.decision - as.double(as.character(tclvalue(â.decision))) natural.units.left.censor - as.double(as.character(tclvalue(left.censor))) natural.units.right.censor - as.double(as.character(tclvalue(right.censor))) tkdestroy(t2) } ### My problem is this: I would like to use the new input in the same routine that created, used, and destroyed the widget. I cant seem to do that. The routine executes with what it has. I must wait for the calling routine to end before I can use the new info, which is correctly place in the workspace, in subsequent R routines. Is there a way I can use the updated values in the same routine that created the widget? Thanks for your advice and patience. Charles Annis, P.E. PS - I did read Prof. Ripley's post of Wed 8/31/2005 Re: [R] tcl/tk return problem but was unable to benefit from it. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] tcl/tk with R
Greetings: I would like to use tcl/tk with R, and have read A Primer on the R-Tcl/Tk Package by Peter Dalgaard in Rnews, Volume 1/3, September 2001. Are there more recent do-it-yourself instructions available? I have been unsuccessful with the example in the tcltk2 package due to a syntax error. I think that I have isolated the problem to this code snippet: for (i in 1:length(Themes)) { tkadd(themeMenu, command, label = Themes[i], command = eval(parse(text = paste(function() tk2theme(\, Themes[sep = } And the problem seems to be here: paste(function() tk2theme(\, Themes[sep = )) Error: syntax error in paste(function() tk2theme(\, Themes[sep = ) Further R seems not to like ' \ ' A closer look at the paste command suggests that it is incomplete and should also contain something like Themes[i], sep= I am using R Version 2.3.1 (2006-06-01) on a DELL WindowsXP system with 2 gig RAM. Many thanks for your counsel. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Display Conditional Probabilities on y-label
The trick is not to paste expressions but to make an expression of the pastes: composite.expression - expression(paste(f(x | , alpha, , , beta, ))) dev.off() par(mar=c(5,5,1,1)+0.1) plot(NA,xlim=c(0,1), ylim=c(0,3),xlab=x,ylab=composite.expression,lwd=3,type=l,cex.lab=1.3) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Phillip Weaver Sent: Monday, June 19, 2006 12:53 PM To: r-help@stat.math.ethz.ch Subject: [R] Display Conditional Probabilities on y-label Hello, I am trying to display a conditional probability for the y-label on a beta distribution plot. Here is the code I have been using: z = expression(f(x|) g = paste(z,expression(alpha),,,expression(beta),)) plot(x,y,ylim=c(0,3),xlab=x,ylab=g,lwd=3,type=l,cex.lab=1.3) The output on the plot is as follows: f(x|alpha,beta) This is what I want except have the greek letters for alpha and beta instead of the words. I have consulted plotmath and other options with no luck. I appreciate any help and thank you ahead of time. best, Brian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Yahoo data download problem
Why create an enormous matrix? Why not read each company's info and immediately write it to the file using write.csv( ... append = TRUE ...)? ^ Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SUMANTA BASAK Sent: Friday, June 16, 2006 7:11 AM To: Petr Pikal; R HELP Subject: Re: [R] Yahoo data download problem Hi Petr, Thanks for the solution. But my problem is still there. I have 500 company names in a single column in an excel sheet of SP 500 index. I need to call all those compnies in a 'for' loop and write that whole dataset into a text file. I've developed the following one, but the problem is getting all those company names in a vector. h-c(GE,MMM) s-matrix(0,3818,2) for (i in 1:2) { s[,i]-yahoo.get.hist.quote(instrument = h[i], destfile = paste(h[i], .csv, sep = ), start=1996-01-01, end=2006-06-16, quote = c(Close), adjusted = TRUE, download = TRUE, origin = 1970-01-01, compression = d) write.csv(s,file=Z:/yahoo.out.csv) } Here i have taken only two compnies. But i want to fetch all the company names and put them in a vector so that i can call them in a 'for' loop. Please guide. Thanks, Sumanta Basak. Petr Pikal [EMAIL PROTECTED] wrote: Hi On 16 Jun 2006 at 8:52, SUMANTA BASAK wrote: Date sent: Fri, 16 Jun 2006 08:52:22 +0100 (BST) From:SUMANTA BASAK To: R HELP , [EMAIL PROTECTED] Subject: [R] Yahoo data download problem Hi all R-Experts, I'm facing one problem in yahoo data downloading. I'm suing Windows XP, R 2.2.0, and i'm using yahoo.get.hist.quote function to download data. I need 500 companies of SP index daily 'closing price' data for last ten years. My questions are: 1) I have all the ticker names of SP 500 companies in a .csv format. I'm reading those names in R and they are coming as data.frame object. How can i change this to a vector? df-data.frame(x=sample(letters,10)) as.vector(df$x) [1] g b p u r q j h o k HTH Petr 2) How can i get all companies data downloaded using a simple for loop? I'm using the following function for a single stock data. library(gdata) s-yahoo.get.hist.quote(instrument = mo, destfile = paste(mo, .csv, sep = ), start=1996-01-01, end=2006-06-16, quote = c(Close), adjusted = TRUE, download = TRUE, origin = 1970-01-01, compression = d) Thanks, Sumanta Basak. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
Concerning the several comments on your note relating to histograms, an informative and entertaining illustration, using Java, of how your subjective assessment of the data can change with different histograms constructed from the same data, is provided by R. Webster West, recently with the Department of Statistics at the University of South Carolina, but as of May 2006 with the Department of Statistics at Texas A M University, http://www.stat.sc.edu/~west/javahtml/Histogram.html and http://www.stat.tamu.edu/~west/ Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Ashmall Sent: Thursday, June 08, 2006 5:46 AM To: r-help@stat.math.ethz.ch Subject: [R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] slanted ends of horizontal lines for certain line widths
I think you want to change par()$lend Type par() enter to see the defaults. In your situation you might want to begin with something like dev.off() par(mar=c(4,6,4,5)+0.1, lend=2) ... then your plotting logic ... Where the mar argument adjusts the margins. (You can omit this if you're happy with the defaults.) And the line end, lend=2, makes the ends square. Best wishes. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Offinger Sent: Sunday, June 04, 2006 11:24 AM To: r-help@stat.math.ethz.ch Subject: [R] slanted ends of horizontal lines for certain line widths Hello, if I plot a horizontal line, e.g., plot(c(1,2),c(1,1),xlim=c(0,3),lwd=2,type=l) or plot(c(1,2),c(1,1),xlim=c(0,3),lwd=4,type=l) then the left end (1st example) or both ends (2nd example) of the lines are not rectangular but slanted on the graphical display (screen). That behavour first occurred when I was trying to plot a stepfun, e.g., y - round(rnorm(12),1) Fn12 - ecdf(y) plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=2,col.h=red) plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=4,col.h=red) (lwd=3 seems okay) Bug or feature? Suggestions? (I don't like the slanted ends but lwd=2 would be better than lwd=3) Robert Offinger OvG-Universität Magdeburg platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] programming advice?
Dear R-helpers: I am doing some exploratory programming and am considering a routine that has several other routines defined within it, so that I can avoid a large and messy global re-programming to avoid naming conflicts. My question is this: Because it is interpreted, does R have to re-build these internal routines every time the new routine is called? I'm not overly worried right now about speed, but since my test cases currently run for several minutes (which is a long time to me) I don't want to learn a lesson the hard way that you, kind readers, might help me avoid. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] programming advice?
Many thanks to Duncan Murdoch, Thomas Lumley, Patrick Burns, and Seth Falcon, for the illuminating advice, which will be found in the R-help archives. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Friday, April 21, 2006 10:46 AM To: R-help@stat.math.ethz.ch Subject: [R] programming advice? Dear R-helpers: I am doing some exploratory programming and am considering a routine that has several other routines defined within it, so that I can avoid a large and messy global re-programming to avoid naming conflicts. My question is this: Because it is interpreted, does R have to re-build these internal routines every time the new routine is called? I'm not overly worried right now about speed, but since my test cases currently run for several minutes (which is a long time to me) I don't want to learn a lesson the hard way that you, kind readers, might help me avoid. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to change legend size in a figure
cex=0.8 (or whatever you like) as in legend(0.3,0.4,c(name1,name2,...),col=1:20,lty=1:20, cex=0.8) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Baoqiang Cao Sent: Tuesday, April 18, 2006 9:38 AM To: r-help@stat.math.ethz.ch Subject: [R] how to change legend size in a figure Dear All, I am producing a figure with many curves on it. How do I make the legends for all those curves smaller so that it can fit the figure itself? The commands I used for ploting are: plot(x1,y1,col=1,lty=1) lines(x2,y2,col=2,lty=2) ... legend(0.3,0.4,c(name1,name2,...),col=1:20,lty=1:20) Any tips for making the legend fit the figure will very welcome! Thanks! Best, Baoqiang Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] nls start values
Please give us an EXAMPLE of the loop you have in mind. (It's likely that you can use simpler methods than a loop, but without an example we'd be guessing.) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cal Stats Sent: Saturday, March 11, 2006 3:43 PM To: r-help@stat.math.ethz.ch Subject: [R] nls start values Hi, I have a large number of parameters to estimate in nls say 100: beta1--beta100 lets say i have 100 values in a vector is there a way where i can create the start vector for nls using a loop instead of individually filling the 100 values. Thanks Harsh - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plotting partial deriviatives
Vielen Dank, Uwe! I dunno how I missed it. Looking only at the demo(plotmath), I guess. Thanks again! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Sunday, March 05, 2006 8:44 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] plotting partial deriviatives Charles Annis, P.E. wrote: Dear R Helpers: I am trying to annotate a plot. The following code snippet works, but it is kind of a kludge since it adds the partial derivative symbols after creating the plotmath frac(). Is there a more elegant way to write a partial derivative? See ?plotmath: There is partialdiff! text(1.6, 1, expression(slope == frac(partialdiff * f(hat(theta)), partialdiff * hat(theta Uwe Ligges dev.off() plot(NA, xlim=c(-3,3), ylim=c(0,1.6), xlab=, ylab=, tck=-0.015) text(1.6, 1, expression(paste(slope = , frac(paste( f( , hat(theta), )), hat(theta))), sep=), adj=0) text(2.25, 1.03, \\pd, vfont=c(sans serif,plain)) text(2.3, 0.934, \\pd, vfont=c(sans serif,plain)) Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to make plotmath expression work together with paste
Hi, Paul: By my lights paste and expression work counter-intuitively. But as has been said here often, you CAN do it in R. Figuring out how might be a challenge, but you CAN do it (whatever it is). Here is some code that does what I think you intended. I also added some phantom characters because I thought the spacing looked too cramped otherwise. (The phantoms are cool since you can adjust their width according to the character you *don't* print.) Anyway, here's the code. I hope you can see how the paste and expression are worked kind of inside out. # dev.off() plot(NA,xlim=c(0,100),ylim=c(0,100)) amath1 - expression(paste(slope = , frac(partialdiff * phantom(.)*f(phantom(.)*hat(theta)*phantom(.)), partialdiff * phantom(.)* hat(theta))),sep=) text(10,70,amath1, adj=0) text(20, 50, expression(slope == frac(partialdiff * phantom(.)*f(phantom(.)*hat(theta)*phantom(.)), partialdiff * phantom(.)* hat(theta))), adj=0) avar1 - 10 text(10,30,bquote(paste(slope = , frac(partialdiff * phantom(.)*f(phantom(.)*hat(theta)*phantom(.)), partialdiff * phantom(.)* hat(theta)),sep=)==.(avar1)), adj=0) # Note that these look much the same but how they're constructed is rather different. Also, have a look at ?substitute and ?bquote Best Wishes, Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Johnson Sent: Sunday, March 05, 2006 8:31 PM To: r-help@stat.math.ethz.ch Subject: [R] how to make plotmath expression work together with paste Recent questions about using plotmath have renewed my interest in this question I want to have expressions take values of variables from the environment. I am able to use expressions, and I am able to use paste to put text and values of variables into plots. But the two things just won't work together. Here is some example code that shows what I mean. plot(NA,xlim=c(0,100),ylim=c(0,100)) #show plot math works text(16, 22, expression(slope == frac(partialdiff * f(hat(theta)), partialdiff * hat(theta # I want to put values of variables into the middle of expressions avar1 - 10 # prove I am able to use paste! text(40,40, paste(a word,avar1,other words) # But I'm completely frustrated by the problem of making paste and # expression work together. amath1 - expression(slope == frac(partialdiff * f(hat(theta)), partialdiff * hat(theta))) # still works text(10,60,amath1) # paste breaks math output text(60,60, paste (amath1, = , avar1) ) # Can't paste expression text(20,30, paste(a word,avar1, expression( partialdiff ))) # paste does not work anymore--value of avar1 not replaced text(50,80, expression(paste(slope == frac(partialdiff * f(hat(theta)),partialdiff * hat(theta)), avar1))) n-12 # This does get the avar1 value in the string and put it in, but it # piles the labels on top of each other. Wish they went side by side text(12, 15, labels=c(expression(bar(x) == sum(frac(x[i], n), i==1, )), paste(gamma =,avar1)),cex = .8) -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plotting partial deriviatives
Dear R Helpers: I am trying to annotate a plot. The following code snippet works, but it is kind of a kludge since it adds the partial derivative symbols after creating the plotmath frac(). Is there a more elegant way to write a partial derivative? dev.off() plot(NA, xlim=c(-3,3), ylim=c(0,1.6), xlab=, ylab=, tck=-0.015) text(1.6, 1, expression(paste(slope = , frac(paste( f( , hat(theta), )), hat(theta))), sep=), adj=0) text(2.25, 1.03, \\pd, vfont=c(sans serif,plain)) text(2.3, 0.934, \\pd, vfont=c(sans serif,plain)) Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Survreg(), Surv() and interval-censored data
How have you defined event? library(survival) ?Surv event: The status indicator, normally 0=alive, 1=dead. Other choices are T/F (TRUE = death) or 1/2 (2=death). For interval censored data, the status indicator is 0=right censored, 1= event at 'time', 2=left censored, 3=interval censored. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Richards Sent: Monday, February 13, 2006 11:45 AM To: r-help@stat.math.ethz.ch Subject: [R] Survreg(), Surv() and interval-censored data Can survreg() handle interval-censored data like the documentation says? I ask because the command: survreg(Surv(start, stop, event) ~ 1, data = heart) fails with the error message Invalid survival type yet the documentation for Surv() states: Presently, the only methods allowing interval censored data are the parametric models computed by 'survreg' Any pointers as to what I'm missing? Stephen -- Richards Consulting +44(0)131 315 4470 Visit http://www.richardsconsulting.co.uk to download presentations and papers on longevity risk, or to use our online calculation tools. A subscription service is available for those companies wishing to stay at the forefront of understanding the financial aspects of longevity risk. Visit http://www.richardsconsulting.co.uk/service.html for more details. Services are provided by Stephen Richards Consulting Ltd, a limited-liability company registered in Scotland, number SC144342. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Tobit Regression (residual Assumption)
Go to the R site and look. http://www.r-project.org/ There has been some recent traffic on this topic. Click on search: Tobit Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bambang pramono Sent: Sunday, February 12, 2006 6:24 PM To: R-help@stat.math.ethz.ch Subject: [R] Tobit Regression (residual Assumption) I'm statistician I need help with tobit regression Is there assumption in tobit regression ? if any, what kind of that ? please help me !! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plots
You could substitute lines(kernelgraf) for your last line: points(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1), col=rgb(0,0,1), main=) See ?lines Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Saturday, February 11, 2006 1:44 PM To: r-help@stat.math.ethz.ch Subject: [R] plots Hi all, I have a basic question. how can i visualize two or more density curves on the same plot? ex: x1-runif(100,10,80) x2-runif(100,1,100) kernelgraf-density(x1,kernel = gaussian, width= 20) plot(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1), col=rgb(0,1,0), main=) kernelgraf-density(x2,kernel = gaussian, width= 20) points(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1), col=rgb(0,0,1), main=) here i am using plot + points, but i do not like the graphical output for points. can anybody help me? thanks in advance Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo e protetta da SPAMfighter 204 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Image Processing packages
Eric: I use R to quantify the efficacy of ultrasonic inspections of metal components (e.g. looking for nonmetallic inclusions in forgings) and use R for image processing, but my methods have been rather a kluge. I am interested in your R functions, if you will make them available. Unfortunately, making a package for CRAN is (in my opinion) WAY too hard on Windows, and I've given up, but I hope that you do not. I second Stephan Matthiesen's recent suggestion that you make your image processing functions available to fellow R users, if not on CRAN, then perhaps as ascii files from your website. Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kort, Eric Sent: Thursday, January 26, 2006 2:39 PM To: Thomas Kaliwe; r-help@stat.math.ethz.ch Subject: Re: [R] Image Processing packages Thomas Kaliwe wrote: Hi, I've been looking for Image Processing packages. Thresholding, Edge Filters, Dct, Segmentation, Restoration. I'm aware, that Octave, Matlab etc. would be a good address but then I'm missing the statistical power of R. Does anybody know of packages, projects etc. Comments on wether the use of R for such matters is useful are welcome. See also my package rtiff for reading tiff images. I routinely do image analysis in R. Yes, it is relatively slow compared to dedicated solutions, but I like the smooth integration with the associated statistical analysis and the ability to have a single script that performs the image analysis and multiple files and subsequent statistical analysis, and with modern computing equipment R is fast enough for my purposes. I have a variety of standard image processing functions written in R, but have yet to distribute them because most people choose not to perform image analysis in R for the previously stated reasons. So in general I would agree that R is sub-optimal for image processing (and this is certainly outside the realm of things R was intended to do if I read the early mailing list archives correctly). However, it can be done and it might be desirable to do so from a work-flow perspective. -Eric Greetings Thomas Kaliwe This email message, including any attachments, is for the so...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] In which application areas is R used?
Please don't forget engineering! (e.g. fatigue and reliability - censored regression and survival; quantitative nondestructive evaluation - GLM) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Maindonald Sent: Monday, January 23, 2006 2:35 PM To: r-help@stat.math.ethz.ch Subject: [R] In which application areas is R used? If anyone has a list of application areas where there is extensive use of R, I'd like to hear of it. My current short list is: Bioinformatics Epidemiology Geophysics Agriculture and crop science John Maindonald Mathematical Sciences Institute, Australian National University. [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bookmarking a page inside r-project.org
You can do something similar with Microsoft's browser but it isn't quite as easy as Foxfire: Right-click on the frame and choose Properties. Then highlight and copy the URL and paste into the address window and click Go. Then save the page. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Baron Sent: Monday, January 02, 2006 7:45 PM To: r-help@stat.math.ethz.ch Subject: [R] bookmarking a page inside r-project.org I'm replying to: https://stat.ethz.ch/pipermail/r-help/2006-January/083823.html In Firefox (a browser), right click on the frame. Then you get a menu that has bookmark as one of the options. Firefox is available from http://www.mozilla.org. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Goodness fit test HELP!
The nice thing about the uniform density is that it's easy to know what the expected pdf(pmf) should look like, namely each observation should have probability 1/n. That means you can use qqplot. See ?qqplot Here's an example, using my.data. my.data - runif(100) n.points - length(my.data) expected.cdf - ((1:n.points)-0.5)/(n.points) qqplot(my.data, expected.cdf, las=1) # Use the interocular trauma test for goodness-of-fit: my.lm - lm(expected.cdf ~ sort(my.data)) abline(coef=coef(my.lm), lty=2) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Amit Kabiri Sent: Saturday, December 03, 2005 11:43 AM To: 'Elizabeth Lawson'; 'David Zhao' Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Goodness fit test HELP! If I have a Uniform distribution to check, How can I use visual fits? Can I also use in some way the qqnorm? Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Elizabeth Lawson Sent: Friday, November 18, 2005 8:06 PM To: David Zhao Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Goodness fit test HELP! What about trying a qqplot to see how the distribution fits... For the normal distribution thta is very stright forward, use qqnorm. To test gamma distribtution (or any other) do some thing like this n-length(data) for(i in 1:n){ prob-(i-1/3)/(n1/3) } quantiles-qgamma(prob,shape=mean(data)/var(data),scale=var(data)/mean(data) } qqplot(data,quantiles) If the distribution is a good for, you should a stright line, like wiht a qqnorm plot! Good luck!! Elizbaeth Lawson David Zhao [EMAIL PROTECTED] wrote: Hi there, I'm a newbie, plesae bear with me. I have a dataset with about 1 ~ 3 data points. Would like fit to both Gamma and Normal distribution to see which one fits better. How do I do this in R? Or I could do a normality test of the data, if it's normal, I then will do a normal fit, otherwise, a gamma fit. But again, I don't know how to do this either. Please help! David [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bimodal data
Your problem sounds like it could be modeled with logistic regression whereby the propensity for one result or another is linked to the factors that control it. Logistic regressions are a special case of generalized linear models. Look at ?glm Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simone Immler Sent: Friday, December 02, 2005 7:43 AM To: r-help@stat.math.ethz.ch Subject: [R] bimodal data Hi, Does anybody have a good tip of how to treat bimodal data to perform statistical analyses? My data set ranges from -1 to 1 (any values are posssible in between) and most data are either close to -1 or close to 1. They are the results of a two choice experiment where individuals could choose more than once in either direction and scores were calculated. Simone Simone Immler University of Sheffield Dep. Animal Plant Sciences Alfred Denny Building Western Bank Sheffield S10 2TN, UK - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] covariance analysis by using R
An informal assessment may be useful: PLOT THE DATA. x y experiment 0.1 0.5 A 0.2 0.6 A 0.3 0.6 A 0.4 0.7 A 0.5 0.9 A 1 3 B 2 4 B 3 6.5 B 4 7.5 B 5 11 B 10 18 C 20 35 C 30 75 C 40 90 C 50 98 C Save the data as a csv file and read it into an R session: data.df - read.csv(file.choose()) data.df Plot it: plot(data.df$x, data.df$y) Not surprisingly, the Cartesian axes obscure the behavior of the Experiment A so we try logs: plot(data.df$x, data.df$y, log=xy) This plot suggests that while Experiments B and C might have a similar relationship between x and y, Experiment A differs. Since I know nothing of the physical meaning of these observations I am unqualified to comment further. Best wishes. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, November 25, 2005 5:32 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] covariance analysis by using R Hi, Is anyone has solved MR Xin Meng problem (see below) ? We have the same analysis configuration : 10 groups (including control one) with 2 mesures for each (ref at t0 and response at t1). We expect to compare each group response with control response (group 1) using a multiple comparison procedure (Dunnett test). In order to perform this test, we have to normalize our data (as you) to correct response values by the base line normalized. Covariance analysis seems to represent the best way to do this. But how to perform this by using R ? So, if someone is able to deal with this problem, could you please share with us your precious knowledge ? Thanks in advance, Best Regards. Alexandre MENICACCI Bioinformatics - FOURNIER PHARMA 50, rue de Dijon - 21121 Daix - FRANCE [EMAIL PROTECTED] tél : 03.80.44.76.17 Original message : Hello sir: Here's a question on covariance analysis which needs your help. There're 3 experiments,and x refers to control while y refers to experimental result. The purpose is to compare the y values across the 3 experiments. experiment_1: x:0.1 0.2 0.3 0.4 0.5 y:0.5 0.6 0.6 0.7 0.9 experiment_2: x:1 2 3 4 5 y:3 4 6.5 7.5 11 experiment_3: x:10 20 30 40 50 y:18 35 75 90 98 Apparently,the control(x) isn't at the similar level so that we can't compare the y directly through ANOVA. We must normalize y via x in order to eliminate the influence of different level of x. The method of normalize I can get is covariance analysis,since x is the covariant of y. My question is: How to perform covariance analysis by using R? After this normalization,we can get the according normalized y of every original y. All in all,the normalized y of every original y is what I want indeed. Thanks a lot! My best regards! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] converting a character string to a subscripted numeric variable
Dear R-helpers: It seems that I have a mental block. (Some say that it sits atop my shoulders.) For reasons too tedious to retell I have an R object: input.line[7] [1] -13.24, -11.24, -9.24, -7.24, -5.24, -3.24, -1.24, 0.76, 2.76, 4.76, 6.76, 8.76, 10.76, 12.76, 14.76, 16.76, 18.76, 20.76, 22.76, 24.76, 26.76, 28.76, 30.76, 32.76, 34.76, 36.76, 38.76, 40.76, 42.76, 44.76, I would like to convert this into a subscripted variable, Beta, something that should be straightforward if I had *almost* what I have. I'd like to say Beta - c(-13.24, -11.24, -9.24, -7.24, -5.24, -3.24, -1.24, 0.76, 2.76, 4.76, 6.76, 8.76, 10.76, 12.76, 14.76, 16.76, 18.76, 20.76, 22.76, 24.76, 26.76, 28.76, 30.76, 32.76, 34.76, 36.76, 38.76, 40.76, 42.76, 44.76) but I can't because: input.line[7] is a character string, and it ends in a comma. This cannot be as difficult as I have found it to be. Can anyone help? Copious Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] converting a character string to a subscripted numeric variable
Eternal gratitude to Sunbar and Matt and Patrick! The easy solution is Beta - as.numeric(strsplit(input.line [7], ,)[[1]]) Beta - Beta[!is.na(Beta)] Beta I have a slew of files to interrogate and need to know from some of the input, what to look for in the remainder of the input. Thanks to all! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED] Sent: Thursday, November 10, 2005 5:00 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] converting a character string to a subscripted numeric variable Charles Annis, P.E. wrote: Dear R-helpers: It seems that I have a mental block. (Some say that it sits atop my shoulders.) For reasons too tedious to retell I have an R object: input.line[7] [1] -13.24, -11.24, -9.24, -7.24, -5.24, -3.24, -1.24, 0.76, 2.76, 4.76, 6.76, 8.76, 10.76, 12.76, 14.76, 16.76, 18.76, 20.76, 22.76, 24.76, 26.76, 28.76, 30.76, 32.76, 34.76, 36.76, 38.76, 40.76, 42.76, 44.76, I would like to convert this into a subscripted variable, Beta, something that should be straightforward if I had *almost* what I have. I'd like to say Beta - c(-13.24, -11.24, -9.24, -7.24, -5.24, -3.24, -1.24, 0.76, 2.76, 4.76, 6.76, 8.76, 10.76, 12.76, 14.76, 16.76, 18.76, 20.76, 22.76, 24.76, 26.76, 28.76, 30.76, 32.76, 34.76, 36.76, 38.76, 40.76, 42.76, 44.76) but I can't because: input.line[7] is a character string, and it ends in a comma. This cannot be as difficult as I have found it to be. Can anyone help? Copious Thanks. How about: x - -13.24, -11.24, x - as.numeric(strsplit(x, ,)[[1]]) x[!is.na(x)] --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to make labels on my dendrogam look more clear and visible
I feel a bit timid in asking this question: Why create the PS? Why not create the pdf directly? ?pdf You have lots of control over the size and other characteristics, and the pdf can be used by MiKTeX to create a TeX - pdf document containing your graphic. I'm running R 2.2.0 on a DELL WinXP machine. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jon butchar Sent: Thursday, October 27, 2005 8:02 PM To: Srinivas Iyyer Cc: r-help@stat.math.ethz.ch Subject: Re: [R] How to make labels on my dendrogam look more clear and visible On Thu, 27 Oct 2005 16:08:48 -0700 (PDT) Srinivas Iyyer [EMAIL PROTECTED] wrote: Dear group, I have a matrix with readings for ~180 variables observed in 240 conditions. I am doing a hierarchical clustering method (hclust) by calculating eucledian distances among them. When I plot the dendrogram from hclust, all my variables at the end of the branches are cluttered. I cannot read them properly. I tried using : x11(width = 100, height = 70, pointsize = 10) plot(mydat.hcluster) and also by x11(width = 1000, height = 300, pointsize = 10) plot(mydat.hcluster) I could not make the dendrogram branches go wide and make variables at the end of braches more legible. Can any one please help me to make a good diagram so that I can see the lables at the end of branches more clearly. Thank you. cheers Sri I don't know if it'll help, but I've grown fond of postscript graphs. For example... postscript(mydendogram.ps, height=800, width=2000, pointsize=[]) plot(mydendogram) dev.off() gives me very clear print, and then the ps2pdf app can turn it into a pdf for e-mailing or import to a presentation. jon b __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Animation of Mandelbrot Set
Works well with both IE and Firefox on my 2 year old DELL WinXP machine. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Wednesday, October 05, 2005 9:38 PM To: Tuszynski, Jaroslaw W. Cc: ([EMAIL PROTECTED]) Subject: Re: [R] Animation of Mandelbrot Set This probably has nothing to do with your software but on my Windows XP system I just get a static image on Internet Explorer with the animated GIF but with Firefox and the same GIF the animation comes out as expected. On 10/4/05, Tuszynski, Jaroslaw W. [EMAIL PROTECTED] wrote: Hi, I was playing with Mandelbrot sets and come up with the following code, I thought I would share: library(fields) # for tim.colors library(caTools) # for write.gif m = 400 # grid size C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ), imag=rep(seq(-1.2,1.2, length.out=m), m ) ) C = matrix(C,m,m) Z = 0 X = array(0, c(m,m,20)) for (k in 1:20) { Z = Z^2+C X[,,k] = exp(-abs(Z)) } image(X[,,k], col=tim.colors(256)) # show final image in R write.gif(X, Mandelbrot.gif, col=tim.colors(256), delay=100) # drop Mandelbrot.gif file from current directory on any web brouser to see the animation Jarek \ Jarek Tuszynski, PhD. o / \ Science Applications International Corporation \__,| (703) 676-4192 \ [EMAIL PROTECTED] ` \ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple plots on same x axis
Try plot(Day, gene1) lines(Day, gene2) see ?lines for more details. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of IAIN GALLAGHER Sent: Tuesday, September 27, 2005 10:35 AM To: r-help@stat.math.ethz.ch Subject: [R] multiple plots on same x axis Hi. I have two vectors of gene expression for each of several days. I want to plot both vectors on the same plot for a visual representation of up versus down regulation. I've tried using add=T but that doesn't work. eg plot(Day, gene1) plot(Day, gene2, add=T) Any help would be appreciated. Iain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Graphical presentation of logistic regression
If a graphical presentation provides improved insight then that is sufficient justification. The existence of better more precise methods, does not change that. I, too, sometimes use jitter() to avoid overplotting of observations, but I think the dot-plots in de la Cruz's code are even better. It is the histogram that is misleading (due to paucity of data), not the effort to elucidate the joint behavior of zeros and ones. http://www.esapubs.org/bulletin/backissues/086-1/bulletinjan2005.htm#et Please try a variation that his code provides: plot.logi.hist(independ = altitude, depend = tree, logi.mod = 1, type = dit, boxp = TRUE, rug = TRUE, las.h = 1) which does not use the histograms but instead uses dit plots to provide a helpful, visceral feel for the behavior of the observations. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jari Oksanen Sent: Thursday, September 15, 2005 3:17 AM To: Frank E Harrell Jr Cc: r-help@stat.math.ethz.ch; Beale, Colin Subject: Re: [R] Graphical presentation of logistic regression On Wed, 2005-09-14 at 06:29 -0500, Frank E Harrell Jr wrote: Beale, Colin wrote: Hi, I wonder if anyone has written any code to implement the suggestions of Smart et al (2004) in the Bulletin of the Ecological Society of America for a new way of graphically presenting the results of logistic regression (see www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t ools1 for the full text)? I couldn't find anything relating to this sort of graphical representation of logistic models in the archives, but maybe someone has solved it already? In short, Smart et al suggest that a logistic regression be presented as a combination of the two histograms for successes and failures (with one presented upside down at the top of the figure, the other the right way up at the bottom) overlaid by the probability function (ie logistic curve). It's somewhat hard to describe, but is nicely illustrated in the full text version above. I think it is a sensible way of presenting these results and am keen to do so - at the moment I can only do this by generating the two histograms and the logistic curve separately (using hist() and lines()), then copying and pasting the graphs out of R and inverting one in a graphics package, before overlying the others. I'm sure this could be done within R and would be a handy plotting function to develop. Has anyone done so, or can anyone give me any pointers to doing this? I really nead to know how to invert a histogram and how to overlay this with another histogram the right way up. Any thoughts would be welcome. Thanks in advance, Colin From what you describe, that is a poor way to represent the model except for judging discrimination ability (if the model is calibrated well). Effect plots, odds ratio charts, and nomograms are better. See the Design package for details. You're correct when you say that this is a poor way to represent the model. However, you should have some understanding to us ecologists who are simple creatures working with tangible subjects such as animals and plants (microbiologists work with less tangible things). Therefore we want to have a concrete and simple representation. After all, the example was about occurrence of an animal against a concrete environmental variable, and a concrete representation was suggested. Nomograms and things are abstractions that you understand first after long education and training (I tried the Design package and I didn't understand the nomogram plot). I tried with one concrete example with my own data, and the inverted histogram method was patently misleading (with Baz Rowlingson's neat and compact code, sorry for the repetition). The method would be useful with dense and regular data only, but now the clearest visual cue was the uneven sampling intensity. With my limited knowledge on R facilities, I can now remember only two ways two preserve the concreteness of display in the base R: jitter() to avoid overplotting of observations, and sunflowerplot() to show the amount of overplotting. I think Ecological Society of America would be happy to receive papers to suggest better ways to represent binary response data, if some of the knowledgeable persons in this groups would decided to educate them (I'm not an ESA member, so I wouldn't be educated: therefore 'them' instead of 'us'). The ESA bulletin will be influential in manuscript submitted to the Society journals in the future, and the time for action is now. cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland Ph. +358 8 5531526, cell +358 40 5136529, fax +358 8 5531061 email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/ __ R
Re: [R] Coefficients from LM
Tsk, tsk. You don't seem to be looking very hard. Here's an example with a glm; lm() works the same way but has fewer internal objects. mod3 - glm(tree ~ altitude, family = binomial) You can use names() to find out what's inside: names(mod3) [1] coefficients residuals fitted.values effects R [6] rank qrfamily linear.predictors deviance [11] aic null.deviance iter weights prior.weights [16] df.residual df.null y converged boundary [21] model call formula terms data [26] offsetcontrol methodcontrasts xlevels There are lots of ways to retrieve the parameter estimates: coefficients(mod3) (Intercept)altitude 13.43360163 -0.01220884 mod3$coeff (Intercept)altitude 13.43360163 -0.01220884 mod3$coef[2] altitude -0.01220884 as.numeric(mod3$coef[2]) [1] -0.01220884 Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pablo Gonzalez Sent: Thursday, September 15, 2005 4:09 PM To: r-help@stat.math.ethz.ch Subject: [R] Coefficients from LM Hi everyone, Can anyone tell me if its possibility to extract the coefficients from the lm() command? For instance, imagine that we have the following data set (the number of observations for each company is actually larger than the one showed...): Company Y X1 X2 1 y_1 x1_1x2_1 1 y_2 x1_2x2_2 1 y_3 x1_3x2_3 (...) 2 y_4 x1_4x2_4 2 y_5 x1_5x2_5 2 y_6 x1_6x2_6 (...) n y_n x1_nx2_n n y_n1x1_n1 x2_n1 n y_n2x1_n2 x2_n2 (...) I need to run a regression of Y=b0+b1*X1+b2*X2 for EACH company in the dataset and then retrieve the coefficients for each regression obtained (and t-stats and R^2) for each company and put it in another dataset/table. The procedure can be done easily done with a loop statement, but i need to retrieve each individual coefficient, t-stat, R^2, etc... I know that, using the $coefficients command will return the vector of coeffcients but I'm having trouble to assignt it to the correct row in the final dataset. Furthermore, I can't find any way of retrieving the R^2 and t-stats... Thanks for any help, Pablo. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] remedial stats education
Given that your goal is understanding the fundamentals (a wise choice as it is problematic attempting to build on an inadequate foundation, and dangerous to use tools that you don't understand), I enthusiastically recommend Peter Dalgaard's book, _Introductory Statistics with R_. Springer, 2002. ISBN 0-387-95475-9. http://www.biostat.ku.dk/~pd/ISwR.html. It is inexpensive, well written, lucid and very helpful. After you've mastered that (and since this is remedial work for you it will not take very long) I further recommend Venables and Ripley, _Modern Applied Statistics with S_, Fourth Edition. Springer, 2002. ISBN 0-387-95457-0. http://www.stats.ox.ac.uk/pub/MASS4/. This book is more demanding and covers a broad spectrum of contemporary statistical practice. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold Sent: Monday, September 12, 2005 8:27 AM To: Joshua N Pritikin; r-help@stat.math.ethz.ch Cc: heartlogic-dev@nongnu.org Subject: Re: [R] remedial stats education There is a Springer publication All of Statistics: a concise course in statistical inference by Larry Wasserman that might be what you are looking for. The book also has an emphasis on R and his web site has code and data sets for analysis of the examples used throughout. -Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joshua N Pritikin Sent: Monday, September 12, 2005 8:16 AM To: r-help@stat.math.ethz.ch Cc: heartlogic-dev@nongnu.org Subject: [R] remedial stats education In short: I didn't take enough stats courses in college. Now I am working on scientific research and I feel somewhat lost when it comes to designing the statistical framework. I have looked through the books at: http://www.r-project.org/doc/bib/R-books.html I even tried to read [17] Julian J. Faraway. Linear Models with R. This book is too advanced. It helped a little bit but I still feel lost. Can somebody recommend a textbook or textbooks suitable for a self-study stats course? Brief bio: I have 20 years background in software development. I know lots of computer languages including C++ and Perl. The computer language aspects of R seems fairly simple. I did some calculus in college but not more than 1-2 courses. I have a basic understanding of probability. I mostly understand descriptive statistics. I feel somewhat lost when it comes to statistical inference. I am good at self-study. I happily spend 12 hours a day reading dry technical manuals. About the research: I have designed a web-based questionaire. http://shared.openheartlogic.org My collaborator (equally stats inept) is working on a similar web-based questionaire http://ruminate.openheartlogic.org Ultimately, we want to publish in a peer-reviewed journal such as Emotion Cognition or, at least, get a paper accepted at the annual Cognitive Science conference. Something like that. We have already started collecting data but not on a large scale since we are not confident about our statistical approach. This is a shot in the dark, but if a stats expert wants to collaborate with us then we would welcome that. We don't have much to offer except, what we think is, exciting research. In any case, a few textbook recommendations would probably help me a lot. -- Make April 15 just another day, visit http://fairtax.org __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Off Topic Simulation Techniques.
_Monte Carlo Statistical Methods_ by Christian P. Robert, George Casella Springer, 2nd ed 2005 This book (I have edition 1) is a dandy. It will be rough sledding unless you have a reasonable background in math stats but I think it is just what you are looking for. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Campbell Sent: Wednesday, July 27, 2005 9:47 AM To: r-help Cc: phineas Subject: [R] Off Topic Simulation Techniques. I wonder if anyone can help me find a text or reference to the probabilistic under pinnings of simulation techniques. I come from an econometrics background where the approach to Monte Carlo is a bit cook booky, most of the focus is on the implementation rather than the theoretical justification. Given a standard setup; a probability triple, random variable and a functional on this random variable, we need to find the measure on the functional. This measure can be approximated by the ECDF, which is the counting measure. Asymptotically the counting measure must coincide with the measure on the functional. Are there any authors who have followed this approach? Phineas Campbell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question from environmental statistics
?qqplot Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, July 15, 2005 9:03 PM To: r-help@stat.math.ethz.ch Subject: [R] question from environmental statistics thanks Fran. that was useful but Im still in a fix. its a real life data which looks like this: 0.9 10.9 24.0 6.7 0.6 1.0 2.4 12.4 7.9 15.8 1.4 7.9 11000.0 (benzene conc. taken after WTC attacks)..its just a small chunk of data i pasted for you to look at. its neither normal nor lognormal. someone told me that qq plot does help in determining the distribution. im not sure how to get it. can someone help me in this. thanks Take a look at this document by Vito Ricci: http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf Did you try RSiteSearch(Fit distribution) or a Google search? That will lead you to fit.dist{gnlm} and fitdistr{MASS} Cheers Francisco From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] question from environmental statistics Date: Thu, 14 Jul 2005 14:06:45 -0700 Dear R users I want to knw if there is a way in which a raw dataset can be modelled by some distribution. besides the gof test is there any test involving gamma or lognormal that would fit the data. thank you -dev __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using index of a loop as a macro variable
x - rep(NA, 3) for (i in 1:length(x)){ x[i] - ... } will do the job, but you may be able to take advantage of R's vectorization and do what you want with no loop at all. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of E. Michael Foster Sent: Monday, July 04, 2005 4:32 PM To: r-help@stat.math.ethz.ch Subject: [R] using index of a loop as a macro variable Hi, I'm a long-time STATA user and a R newbie. I'm doing ok, but I'm addicted to STATA macro variables. Is there something like a macro variable in R? Specifically, I'd like to be able to do something like for (i in 1:3) { . x`i' - ... } where R would resolve x`i' to the objects named x1, x2 and x3 as I move through the loop. I guess I could create these in advance of the loop and fill them in, but I'd rather not. Is there a way to use an index of a loop in this manner? thanks, michael E. Michael Foster Professor of Maternal and Child Health School of Public Health University of North Carolina __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] comparing lm(), survreg( ... , dist=gaussian) and survreg( ... , dist=lognormal)
Dear R-Helpers: I have tried everything I can think of and hope not to appear too foolish when my error is pointed out to me. I have some real data (18 points) that look linear on a log-log plot so I used them for a comparison of lm() and survreg. There are no suspensions. survreg.df - data.frame(Cycles=c(2009000, 577000, 145000, 376000, 37000, 979000, 1742, 71065000, 46397000, 70168000, 6912, 68798000, 72615000, 133051000, 38384000, 15204000, 1558000, 14181000), stress=c(90, 100, 110, 90, 100, 80, 70, 60, 56, 62, 62, 59, 56, 53, 59, 70, 90, 70), event=rep(1, 18)) sN.lm- lm(log(Cycles) ~ log10(stress), data=survreg.df) and vvv gaussian.survreg- survreg(formula=Surv(time=log(Cycles), event) ~ log10(stress), dist=gaussian, data=survreg.df) produce identical parameter estimates and differ slightly in the residual standard error and scale, which is accounted for by scale being the MLE and thus biased. Correcting by sqrt(18/16) produces agreement. Using predict() for the lm, and predict.survreg() for the survreg model and correcting for the differences in stdev, produces identical plots of the fit and the upper and lower confidence intervals. All of this is as it should be. And, vv lognormal.survreg- survreg(formula=Surv(time=(Cycles), event) ~ log10(stress), dist=lognormal, data=survreg.df) produces summary() results that are identical to the earlier call to survreg(), except for the call, of course. The parameter estimates and SE are identical. Again this is as I would expect it. But since the call uses Cycles, rather than log(Cycles) predict.survreg() returns $fit in Cycles units, rather than logs, and of course the fits are identical when plotted on a log-log grid and also agree with lm() Here is the fly in the ointment: The upper and lower confidence intervals, based on the $se.fit for the dist=lognormal are quite obviously different from the other two methods, and although I have tried everything I could imagine I cannot reconcile the differences. I believe that the confidence bounds for both models should agree. After all, both calls to survreg() produce identical parameter estimates. So I have missed something. Would some kind soul please point out my error? Thanks. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Using R to illustrate the Central Limit Theorem
This won't help teach R, but it might illuminate the CLT. Here are a series of animated GIFs that begin with different densities, including one that has a U shape, and plots the density of Xbar for n=2,3,4,8,16,32. http://www.StatisticalEngineering.com/central_limit_theorem.htm I've also included an explanation of what is happening at each iteration. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Smith Sent: Thursday, April 21, 2005 1:07 PM To: r-help@stat.math.ethz.ch Subject: [R] Using R to illustrate the Central Limit Theorem Dear All I am totally new to R and I would like to know whether R is able and appropriate to illustrate to my students the Central Limit Theorem, using for instance 100 independent variables with uniform distribution and showing that their sum is a variable with an approximated normal distribution. Thanks in advance, Paul __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] GLM fitting
Vito: Please plot your data: y - c(1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0) x - c(37, 35, 33, 40, 45, 41, 42, 20, 21, 25, 27, 29, 18) plot(x, y) You will see that ANY step function between 29 x 33 will describe these observations perfectly. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vito Ricci Sent: Friday, January 28, 2005 5:14 AM To: r-help@stat.math.ethz.ch Subject: [R] GLM fitting DeaR R-useRs, I'm trying to fit a logist model with these data: dati y x 1 1 37 2 1 35 3 1 33 4 1 40 5 1 45 6 1 41 7 1 42 8 0 20 9 0 21 10 0 25 11 0 27 12 0 29 13 0 18 I use glm(), having this output: g-glm(y~x,family=binomial,data=dati) Warning messages: 1: Algorithm did not converge in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart, 2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart, g Call: glm(formula = y ~ x, family = binomial, data = dati) Coefficients: (Intercept)x -348.2311.23 Degrees of Freedom: 12 Total (i.e. Null); 11 Residual Null Deviance: 17.94 Residual Deviance: 7.011e-10AIC: 4 I don't understand the meaning of warning. Can anyone help me? Many thanks. Cheers, Vito = Diventare costruttori di soluzioni Became solutions' constructors The business of the statistician is to catalyze the scientific learning process. George E. P. Box Top 10 reasons to become a Statistician 1. Deviation is considered normal 2. We feel complete and sufficient 3. We are 'mean' lovers 4. Statisticians do it discretely and continuously 5. We are right 95% of the time 6. We can legally comment on someone's posterior distribution 7. We may not be normal, but we are transformable 8. We never have to say we are certain 9. We are honestly significantly different 10. No one wants our jobs Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/palese/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Johnson transformation
Greetings, Carla: While it is possible to map any proper density into a normal through their CDFs, that may not be useful in your case. I suggest that you first plot your data. ?qqnorm (Type ?qqnorm on the R command line and hit Enter.) Are your data continuous, or do they occur in groups? Do the data curve? Do they look like two (or more) distinct lines? If your data have only one mode and if they are smooth then the Box-Cox transform should provide a symmetrical result. Not all symmetrical densities are normal, of course. And if your data are discrete then using a continuous density like the normal (or Johnson family) is inappropriate. The purpose of fitting a distribution to data is usually to permit some probability statement, like Prob(x X) = alpha. Why do you want to use the Johnson family? I am not aware of convenient methods for making such probability statements for them. Best wishes. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, January 20, 2005 10:16 AM To: r-help Subject: [R] Johnson transformation Hello, I'm Carla, an italian student, I'm looking for a package to transform non normal data to normality. I tried to use Box Cox, but it's not ok. There is a package to use Johnson families' transormation? Can you give me any suggestions to find free software as R that use this trasform? Thank yuo very much Carla 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero! Scaricalo su INTERNET GRATIS 6X http://www.libero.it __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Exact poisson confidence intervals
Federico: You might also look at Professor Agresti's observations on exact vs approximate, which appeared in the American Statistician a few years ago. (I believe it was the AS; my memory isn't what it once was.) Google produced this http://www.amstat.org/publications/tas/index.cfm?fuseaction=agresti1998 when searching for approximate is better than exact Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Spencer Graves Sent: Thursday, January 13, 2005 7:08 PM To: Uwe Ligges Cc: R-help mailing list Subject: Re: [R] Exact poisson confidence intervals Exact confidence limits are highly conservative. I have not studied this for the Poisson distribution, but for the binomial distribution, Brown, Cai and DasGupta (2001, 2002) showed that the exact coverage probabilities exhibit increasingly wild oscillations as the binomial probability goes to either 0 or 1. The interval width for exact 95% confidence intervals is increased to compensate for these oscillations so the minimum coverage is 95%. In practice, this means that the actually coverage may be much higher, possible as much as 99% or more in most applications. Moreover, unless the binomial / Poisson parameter is exactly constant, any minor variations in the parameter would move the peaks to fill the valleys, making the exact intervals highly conservative. As part of this work, Brown, Cai and DasGupta also showed that the actual coverage probabilities of the standard approximate confidence limits [p.bar +/-2*sqrt(p.bar*(1-p.bar)/n)] are highly biased. They described several other alternatives. It turns out that the standard asymptotic normal approximation to the logit actually performs fairly close to the best. By extension, I would expect that the standard asymptotic normal approximation for the log(PoissonRate) might perform better than other confidence intervals for the Poisson, though of course, this should be verified. At the risk of making a fool of myself, I'll continue with this exercise: If I haven't made a mistake, the Fisher information for g = log(PoissonRate) is the PoissonRate, so the approximate standard deviation for g-hat is 1/sqrt(PoissonRate). But the maximum likelihood estimate for the PoissonRate is x.bar = mean of the Poisson observations. This would suggest x.bar*exp(+/-2/sqrt(x.bar)) as an approximate 95% confidence interval for a Poisson. If someone does any checks on this, I would like to hear the results. hope this helps. spencer graves ### Brown, Cai and DasGupta (2001) Statistical Science, 16: 101-133 and (2002) Annals of Statistics, 30: 160-2001 ### Uwe Ligges wrote: Federico Gherardini wrote: Hi all, Is there any R function to compute exact confidence limits for a Poisson distribution with a given Lambda? For sure you are looking for certain quantiles of the poisson distribution? See ?Poisson. Uwe Ligges Thanks in advance Federico __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] t-test pvalue
pt(q, ...) returns the area to the left of q. The area to the left of 2.23 for your situation is 0.975, while the area to the left of -2.23 (which is on the left side of zero from 2.23) is 0.025. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Giovanni Coppola Sent: Wednesday, December 29, 2004 8:41 PM To: r-help@stat.math.ethz.ch Subject: [R] t-test pvalue Hi all, I have some t-test values, and I am trying to obtain the associated p-values. Is 'pt' the right command? I wonder why 1) it returns different values for x and -x, and 2) how to obtain a 2-sided p-value. example [R version 2.0.1, WinXP]: #if t=2.23 (df=10), the expected p-value is 0.05 for 2-sided and 0.025 for 1-sided t-test pt (2.23,10) [1] 0.9750788 pt (-2.23,10) #or pt (2.23,10,lower.tail=FALSE) [1] 0.02492124 #as expected The opposite happens starting from negative t-test values. Should I convert in negative values my t-test values, and leave lower.tail=TRUE? Thanks and happy new year Giovanni __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] plots
Yes. Assuming you are using R in Windows, right click on the plot, and choose Save as metafile, or more expeditiously, Copy as metafile, and then paste directly into your WORD document. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of duraikannan sundaramoorthi Sent: Monday, December 27, 2004 8:00 PM To: r-help@stat.math.ethz.ch Subject: [R] plots Is there a way to save plots and use in a word document. Thanks for your help in advance. durai __ Send holiday email and support a worthy cause. Do good. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html