Re: [R] Software for kriging
Hi the emulator package of the the BACCO bundle includes kriging as a special case. HTH Robin On 4 Jan 2007, at 04:56, [EMAIL PROTECTED] wrote: Dear R-list members, I wish everyone a happy and successful 2007! Does anyone know of R-based software for optimal spatial prediction (kriging)? We are working on a seismic event characterisation technique and need to do some kriging. Any help would be greatly appreciated. Augusto Augusto Sanabria. MSc, PhD. Mathematical Modeller Risk Research Group Geospatial Earth Monitoring Division Geoscience Australia (www.ga.gov.au) Cnr. Jerrabomberra Av. Hindmarsh Dr. Symonston ACT 2601 Ph. (02) 6249-9155 __ 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. -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ 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] need help with debug package
I think I have figured out part of the answer, when I entered a debugger, the calling environment (parent frame) refers to the debugger program, instead of the mainfun( ). But is there anyway to solve this problem ? thanks - Original Message - From: Tong Wang [EMAIL PROTECTED] Date: Wednesday, January 3, 2007 9:30 pm Subject: need help with debug package To: R help r-help@stat.math.ethz.ch Hi all, I met a problem while using the debug package, I have the following program: mainfun- function(){ beta-1 result-subfun(beta+x) } subfun-function(expr){ y - eval(expr, envir=list(x=c(1,2)),enclos = parent.frame()) return(y) } I have no problem using this program without calling the debug package. but once I mtrace(subfun), the debugger can't find all the beta after entering subfun , and give the message : Error in beta : non-numeric argument to binary operator Is there anyway to get around ? thanks a lot happy new year __ 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 re zinb model
On Thu, 4 Jan 2007, [EMAIL PROTECTED] wrote: Remember that -2 * the difference in the likelihoods between the two models is asymptotically chi-squared distributed, with degrees of freedom equal to the difference in number of parameters between the models. So you can just calculate that for your preferred and null models, then use the pchisq function to test significance. Get the likelihoods from obj$maxlike. The function lrtest() in package lmtest offers a flexible implementation of this which works for fitted models that provide a logLik() method. The zicounts() implementation does not, but zeroinfl() in package pscl. E.g. you can do: library(pscl) data(teeth, package = zicounts) fm1 - zeroinfl(dmft ~ gender + age | gender + age, data = teeth, dist = negbin) summary(fm1) fm2 - zeroinfl(dmft ~ 1, data = teeth, dist = negbin) summary(fm2) library(lmtest) lrtest(fm1, fm2) hth, Z __ 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] dashed lines and SVG files devSVG(/folderul/unde/salvez/myplot.svg, width=10, height=10) plot(1:10, 1:10) dev.off()
Dear helpers, I have a question about the SVG device. It works fine, the SVG file is indeed produced, only the graphic differs from the R window. In the SVG file the dashed line is just a regular plain one. My toy example is: library(RSvgDevice) devSVG(myplot.svg, width=10, height=10) plot(1:10) abline(v=5, lty=¨dashed¨) dev.off() Is there anything more (or different) I should do? Many thanks in advance, 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.
Re: [R] Time series plot
Check out #2 in: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/85801.html and RSiteSearch(axis(4) to find additional examples. On 1/4/07, Arun Kumar Saha [EMAIL PROTECTED] wrote: Dear Gabor, Thank you very much for your letter. Actually I got partial solution from your suggestion. Still I am fighting with defining a secondary axis. More pecisely, suppose I have following two dataset: x = c(1:10) y = x*10 To plot x I can simply write plot(x, type='l'), here they-axis takes value from 1:10. Now I want to plot y on a Secondary Y-axis on same graphics window. Secondary y-axis will take value from 1:100 and plot y accordingly, just like Microsoft Excel. Is there any solution? Thanks and regards, On 1/4/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: You can use read.zoo in the zoo package to read in the data and then see: https://www.stat.math.ethz.ch/pipermail/r-help/2006-December/122742.html See ?axis for creating additional axes with classic graphics and library(lattice) ?panel.axis in lattice graphics. Search the archives for examples. On 1/4/07, Arun Kumar Saha [EMAIL PROTECTED] wrote: Dear all R users, Suppose I have a data set like this: date price 1-Jan-02 4.8803747 2-Jan-02 4.8798430 3-Jan-02 4.8840133 4-Jan-02 4.8803747 5-Jan-02 4.8749683 6-Jan-02 4.8754263 7-Jan-02 4.8746628 8-Jan-02 4.8753500 9-Jan-02 4.8882416 10-Jan-02 4.8895217 11-Jan-02 4.8871108 I want to get a time series plot of that dataset. But in x-axis I want to see the first day, and last day, and other day in between them i.e. 1-Jan-02, 6-Jan-02, and 11-Jan-02 only. Can anyone tell me how to do that? My second question is that is there any way to define a secondary axis like Microsoft Excel in the same plot window? Thanks and regards, Arun [[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] dashed lines and SVG files
Sorry for duplicating the message, the previous had an unintended subject line... Dear helpers, I have a question about the SVG device. It works fine, the SVG file is indeed produced, only the graphic differs from the R window. In the SVG file the dashed line is just a regular plain one. My toy example is: library(RSvgDevice) devSVG(myplot.svg, width=10, height=10) plot(1:10) abline(v=5, lty=¨dashed¨) dev.off() Is there anything more (or different) I should do? Many thanks in advance, 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] pretended size postscript and size of the graphic device window
Dear list members! I've two questions concerning graphic export: a) I want to export my graphics as PostScript files. in this way I use the postscript() function. The tricky part is that they must have a pretended size (7 x 7 cm) and an absoulte font size (10pt). b) how can i (permanent) change the size of the graphic device window? Best regards mirca heli -- __ 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] Time series plot
Hi On 4 Jan 2007 at 14:18, Arun Kumar Saha wrote: Date sent: Thu, 4 Jan 2007 14:18:11 +0530 From: Arun Kumar Saha [EMAIL PROTECTED] To: Gabor Grothendieck [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch R-help@stat.math.ethz.ch Subject:Re: [R] Time series plot Dear Gabor, Thank you very much for your letter. Actually I got partial solution from your suggestion. Still I am fighting with defining a secondary axis. More pecisely, suppose I have following two dataset: x = c(1:10) y = x*10 To plot x I can simply write plot(x, type='l'), here they-axis takes value from 1:10. Now I want to plot y on a Secondary Y-axis on same I think you are lost a bit in plotting let's x be x-rnorm(10) and y-x*10 then gives you x values on y axis and x axis is 1:10. You can put another values y on the same plot but only if you give them space before plot(x, type=l, ylim=range(y)) points(y) but it is probably not what you want. If you want to plot time series to get time labels on x axis then Gabor's solution would be perfectly valid. Or you can convert your date (which is probably factor) to real time. tab=read.table(clipboard, header=T) tab dateprice 1 1-Jan-02 4.880375 2 2-Jan-02 4.879843 3 3-Jan-02 4.884013 4 4-Jan-02 4.880375 5 5-Jan-02 4.874968 6 6-Jan-02 4.875426 7 7-Jan-02 4.874663 8 8-Jan-02 4.875350 9 9-Jan-02 4.888242 10 10-Jan-02 4.889522 11 11-Jan-02 4.887111 tab$newdate - as.POSIXct(strptime(tab$date, format=%d-%b-%y)) str(tab) 'data.frame': 11 obs. of 3 variables: $ date : Factor w/ 11 levels 1-Jan-02,10-Jan-02,..: 1 4 5 6 7 8 9 10 11 2 ... $ price : num 4.88 4.88 4.88 4.88 4.87 ... $ newdate:'POSIXct', format: chr 2002-01-01 2002-01-02 2002-01- 03 2002-01-04 . plot(tab$newdate, tab$price) what is what you may want without explicit need for secondary y axis. HTH Petr graphics window. Secondary y-axis will take value from 1:100 and plot y accordingly, just like Microsoft Excel. Is there any solution? Thanks and regards, On 1/4/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: You can use read.zoo in the zoo package to read in the data and then see: https://www.stat.math.ethz.ch/pipermail/r-help/2006-December/122742. html See ?axis for creating additional axes with classic graphics and library(lattice) ?panel.axis in lattice graphics. Search the archives for examples. On 1/4/07, Arun Kumar Saha [EMAIL PROTECTED] wrote: Dear all R users, Suppose I have a data set like this: date price 1-Jan-02 4.8803747 2-Jan-02 4.8798430 3-Jan-02 4.8840133 4-Jan-02 4.8803747 5-Jan-02 4.8749683 6-Jan-02 4.8754263 7-Jan-02 4.8746628 8-Jan-02 4.8753500 9-Jan-02 4.8882416 10-Jan-02 4.8895217 11-Jan-02 4.8871108 I want to get a time series plot of that dataset. But in x-axis I want to see the first day, and last day, and other day in between them i.e. 1-Jan-02, 6-Jan-02, and 11-Jan-02 only. Can anyone tell me how to do that? My second question is that is there any way to define a secondary axis like Microsoft Excel in the same plot window? Thanks and regards, Arun [[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. [[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. Petr Pikal [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.
Re: [R] pretended size postscript and size of the graphic device window
On Thu, 2007-01-04 at 12:21 +0100, mirca heli wrote: Dear list members! I've two questions concerning graphic export: a) I want to export my graphics as PostScript files. in this way I use the postscript() function. The tricky part is that they must have a pretended size (7 x 7 cm) and an absoulte font size (10pt). If I understand you correctly, ?postscript contains all you need to know, eg: postscript(file=foo.eps, paper=special, onefile=FALSE, width=7/2.54, height=7/2.54, pointsize=10, horizontal=FALSE) plot(rnorm(100), rnorm(100), main = foo) dev.off() Is this what you wanted? b) how can i (permanent) change the size of the graphic device window? This may well depend on your OS (unstated). I was looking for this the other day as the window is too big on my laptop - I didn't look to hard though so it is no surprise that I did not find a solution. HTH G Best regards mirca heli -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] pretended size postscript and size of the graphic device window
mirca heli wrote: Dear list members! I've two questions concerning graphic export: a) I want to export my graphics as PostScript files. in this way I use the postscript() function. The tricky part is that they must have a pretended size (7 x 7 cm) and an absoulte font size (10pt). See ?postscript and its arguments width, height, paper and pointsize. b) how can i (permanent) change the size of the graphic device window? For the postscript device, see ?ps.options. Uwe Ligges Best regards mirca heli -- __ 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] pretended size postscript and size of the graphic device window
On 1/4/2007 6:21 AM, mirca heli wrote: Dear list members! I've two questions concerning graphic export: a) I want to export my graphics as PostScript files. in this way I use the postscript() function. The tricky part is that they must have a pretended size (7 x 7 cm) and an absoulte font size (10pt). b) how can i (permanent) change the size of the graphic device window? Most of the graphics device functions take args to set their size. You can create your own function and use it instead of the standard one, with different defaults: e.g. mywin - function() windows(2,2) options(device=mywin) Now I'll get really tiny windows. You can put these lines in your .Rprofile (see ?Startup) if you want them to happen in all sessions. Duncan Murdoch __ 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] setting new working directories
Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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] setting new working directories
See ?getwd and ?setwd to set the working directory See ?load and ?save to read the workspace. Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Bill Shipley Verzonden: donderdag 4 januari 2007 15:42 Aan: R help list Onderwerp: [R] setting new working directories Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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] setting new working directories
The basic command for this is setwd() (for set working directory) You can save your workspace after you use the setwd command, and this will create a .RData file in that directory. In windows you can click on the .RData directory to open R using that particular working directory. You can always check on the current working directory using getwd(). Another useful command in this context is save.image (see ?save.image for details) Abhijit Bill Shipley wrote: Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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] setting new working directories
Bill Shipley wrote: Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. RSiteSearch(working directory) is very helpful. In particular, look at the help pages for getwd() and setwd(). Bill Shipley __ 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. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ 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] setting new working directories
use setwd() and getwd(). see ?setwd or on the shortcut properties tab, set the target directory to your working dir and have as many shortcuts as working directories. working with R commands does it for me. all the best. A. - Original Message From: Bill Shipley [EMAIL PROTECTED] To: R help list r-help@stat.math.ethz.ch Sent: Thursday, January 4, 2007 9:41:35 AM Subject: [R] setting new working directories Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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] setting new working directories
An additional note for Windows. The directory name needs to be written as C:/Project/Working directory or C:\\Project\\Working directory as opposed to the usual way of referencing directories in Windows. AA wrote: use setwd() and getwd(). see ?setwd or on the shortcut properties tab, set the target directory to your working dir and have as many shortcuts as working directories. working with R commands does it for me. all the best. A. - Original Message From: Bill Shipley [EMAIL PROTECTED] To: R help list r-help@stat.math.ethz.ch Sent: Thursday, January 4, 2007 9:41:35 AM Subject: [R] setting new working directories Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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] setting new working directories
Abhijit Dasgupta wrote: An additional note for Windows. The directory name needs to be written as C:/Project/Working directory or C:\\Project\\Working directory as opposed to the usual way of referencing directories in Windows. Which are? Those are the forms given in the Microsoft documentation. The 2002 edition of MASS is not at all out of date: the 1994 edition is explicitly about S-PLUS (and the 'Windows' version of S-PLUS in 1994 was in fact a DOS program running under an extender). AA wrote: use setwd() and getwd(). see ?setwd or on the shortcut properties tab, set the target directory to your working dir and have as many shortcuts as working directories. working with R commands does it for me. all the best. A. - Original Message From: Bill Shipley [EMAIL PROTECTED] To: R help list r-help@stat.math.ethz.ch Sent: Thursday, January 4, 2007 9:41:35 AM Subject: [R] setting new working directories Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). Thanks. Bill Shipley __ 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-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] setting new working directories
Bill Shipley wrote: Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. If you make a new directory, then in it put a copy of a shortcut to R (actually to Rgui.exe in R's bin directory) then right click on the shortcut, select 'Properties', and set the 'start in' to your new working directory, you can browse to that directory in windows, double click the R shortcut, and be working in that new working directory with no setwd() needed. Barry PS oh, I mean 'folder' not 'directory' of course, this is Windows... __ 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] mcmcsamp and variance ratios
On 1/3/07, Martin Henry H. Stevens [EMAIL PROTECTED] wrote: Hi folks, I have assumed that ratios of variance components (Fst and Qst in population genetics) could be estimated using the output of mcmcsamp (the series on mcmc sample estimates of variance components). What I have started to do is to use the matrix output that included the log(variances), exponentiate, calculate the relevant ratio, and apply either quantile or or HPDinterval to get confidence intervals. This seems too simple but I can't think of what is wrong with it. Why bother exponentiating? I'm not sure what ratios you want but if they are ratios of two of the variances that are columns of the matrix then you just need to take the difference of the logarithms. I expect that the quantiles and HPDintervals would be better behaved, in the sense of being based on a distribution that is close to symmetric, on the scale of the logarithm of the ratio instead of the ratio itself. Quantiles calculated for the logarithm of the ratio will map to quantiles of the ratio. However, if you really do feel that you must report an HPDinterval on the ratio then you would need to exponentiate the logarithm of the ratio before calculating the interval. Technically the HPD interval of the ratio is not the same as exponentiating the end points of the HPDinterval of the logarithm of the ratio but I doubt that the differences would be substantial. __ 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] export many plots to one file
Dear useRs, I have a few hundred plots that I'd like to export to one document. pdf() isn't an option, because the file created is prohibitively huge (due to scatter plots with many points). So I have to use png() instead, but then I end up with a lot of files (would prefer just one). 1. Is there a way to have pdf() embed images, instead of vector instructions? (What would have to be changed/added, and where? I'd consider that a very useful feature.) 2. Does anyone have a script for importing many images (png, bitmap, jpg) into one PDF file? I'd prefer something that works both on Windows and GNU. Thank you, 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 and provide commented, minimal, self-contained, reproducible code.
[R] get.hist.quote
Odd behavior from get.hist.quote this AM. get.hist.quote('sunw') trying URL 'http://chart.yahoo.com/table.csv?s=sunwa=0b=02c=1991d=0e=03f=2007g=dq=qy=0z=sunwx=.csv' Content type 'text/csv' length unknown opened URL .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . downloaded 189Kb Error in if (!quiet dat[n] != start) cat(format(dat[n], time series starts %Y-%m-%d\n)) : missing value where TRUE/FALSE needed Indentical for 2.4.0 on SuSE 10.1 and 2.4.1 on Win XP. jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ 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] export many plots to one file
I can think of two options: 1. Use R2HTML and save the html output as PDF 2. Use Sweave and compile the LaTeX file to PDF. Search the mailing list archive on how to save the graphs as png or jpeg (as Sweave will standard generate eps or pdf graphs). Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens bogdan romocea Verzonden: donderdag 4 januari 2007 17:35 Aan: r-help Onderwerp: [R] export many plots to one file Dear useRs, I have a few hundred plots that I'd like to export to one document. pdf() isn't an option, because the file created is prohibitively huge (due to scatter plots with many points). So I have to use png() instead, but then I end up with a lot of files (would prefer just one). 1. Is there a way to have pdf() embed images, instead of vector instructions? (What would have to be changed/added, and where? I'd consider that a very useful feature.) 2. Does anyone have a script for importing many images (png, bitmap, jpg) into one PDF file? I'd prefer something that works both on Windows and GNU. Thank you, 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 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] Time series plot
Here's an example illustrating a way to get a second y axis that has a different range: x - 1:10 y1 - 2*x y2 - 100-3*x+rnorm(10) par(mar=c(5.1,4.1,4.1,4.1)) plot(x,y1) par(new=TRUE) plot(x,y2,xaxt='n',yaxt='n',xlab='',ylab='',pch=3) axis(4) mtext('y2',side=4,line=2.5) -Don At 2:18 PM +0530 1/4/07, Arun Kumar Saha wrote: Dear Gabor, Thank you very much for your letter. Actually I got partial solution from your suggestion. Still I am fighting with defining a secondary axis. More pecisely, suppose I have following two dataset: x = c(1:10) y = x*10 To plot x I can simply write plot(x, type='l'), here they-axis takes value from 1:10. Now I want to plot y on a Secondary Y-axis on same graphics window. Secondary y-axis will take value from 1:100 and plot y accordingly, just like Microsoft Excel. Is there any solution? Thanks and regards, On 1/4/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: You can use read.zoo in the zoo package to read in the data and then see: https://www.stat.math.ethz.ch/pipermail/r-help/2006-December/122742.html See ?axis for creating additional axes with classic graphics and library(lattice) ?panel.axis in lattice graphics. Search the archives for examples. On 1/4/07, Arun Kumar Saha [EMAIL PROTECTED] wrote: Dear all R users, Suppose I have a data set like this: date price 1-Jan-02 4.8803747 2-Jan-02 4.8798430 3-Jan-02 4.8840133 4-Jan-02 4.8803747 5-Jan-02 4.8749683 6-Jan-02 4.8754263 7-Jan-02 4.8746628 8-Jan-02 4.8753500 9-Jan-02 4.8882416 10-Jan-02 4.8895217 11-Jan-02 4.8871108 I want to get a time series plot of that dataset. But in x-axis I want to see the first day, and last day, and other day in between them i.e. 1-Jan-02, 6-Jan-02, and 11-Jan-02 only. Can anyone tell me how to do that? My second question is that is there any way to define a secondary axis like Microsoft Excel in the same plot window? Thanks and regards, Arun [[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. [[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. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ 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] get.hist.quote
On 1/4/07, BBands [EMAIL PROTECTED] wrote: Odd behavior from get.hist.quote this AM. Now working, must have been a Yahoo! issue. jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ 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] setting new working directories
Bill, I like to use Windows Explorer to find folders and then launch R with the selected folder as the working directory. I put some notes online about this: http://research.stowers-institute.org/efg/R/TechNote/WindowsExplorerWorkingDirectory/index.htm efg Bill Shipley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. __ 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] Seek general information about time/date storage and functions in R
Hello R List - I have to import Excel files (either as .csv files or using RODBC) into R (2.4.1, Windows) and operate on dates and times (e.g. find minutes between times, change dates to days of week or analyze by weeks of year). The help files for format.Date, strptime, as.POSIX, DateTimeClasses, etc. etc. are informative but perhaps a little terse. I have googled unsuccessfully for a more general description of how R represents times and dates, and the methods (e.g. date arithmetic) for working with them. Can a reader point out such an introduction, preferably on-line? Thank you, Ben Fairbank [[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.
Re: [R] setting new working directories
On 1/4/2007 9:41 AM, Bill Shipley wrote: Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). I don't think R has facilities for creating directories: you would do that in the OS, e.g. in Windows Explorer, right click and ask for New | Folder. In Windows the easiest way to set a directory as the current working directory is setwd(choose.dir()) In the choose.dir dialog you can type the directory name in standard Windows format (don't worry about escaping \), or you can use the directory browser to choose it. By the way, if you do decide to switch to Unix, you'll have to do without choose.dir() (unless it's in a contributed package somewhere). Duncan Murdoch __ 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] Seek general information about time/date storage and functionsin R
I think the best explanation of dates and times is in r-news 2.4.1 but 2.4.1 might be off so someone will hopefully correct me if I'm wrong. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Fairbank Sent: Thursday, January 04, 2007 12:43 PM To: r-help@stat.math.ethz.ch Subject: [R] Seek general information about time/date storage and functionsin R Hello R List - I have to import Excel files (either as .csv files or using RODBC) into R (2.4.1, Windows) and operate on dates and times (e.g. find minutes between times, change dates to days of week or analyze by weeks of year). The help files for format.Date, strptime, as.POSIX, DateTimeClasses, etc. etc. are informative but perhaps a little terse. I have googled unsuccessfully for a more general description of how R represents times and dates, and the methods (e.g. date arithmetic) for working with them. Can a reader point out such an introduction, preferably on-line? Thank you, Ben Fairbank [[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. This is not an offer (or solicitation of an offer) to buy/se...{{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.
Re: [R] Seek general information about time/date storage and functions in R
On 1/4/2007 12:42 PM, Ben Fairbank wrote: Hello R List - I have to import Excel files (either as .csv files or using RODBC) into R (2.4.1, Windows) and operate on dates and times (e.g. find minutes between times, change dates to days of week or analyze by weeks of year). The help files for format.Date, strptime, as.POSIX, DateTimeClasses, etc. etc. are informative but perhaps a little terse. I have googled unsuccessfully for a more general description of how R represents times and dates, and the methods (e.g. date arithmetic) for working with them. Can a reader point out such an introduction, preferably on-line? There was an article in R-News on just this topic, in the R Help Desk in http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf . Duncan Murdoch __ 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] export many plots to one file
The approach I would take (possibly due to ignorance of a better option) is to export to the multiple .png files, then use a tool like imagemagick to combine them into a single pdf file. For a quick test I exported 3 graphs from R and called them test1.png, test2.png, and test3.png. The imagemagick command is then just: convert test*.png test.pdf Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea Sent: Thursday, January 04, 2007 9:35 AM To: r-help Subject: [R] export many plots to one file Dear useRs, I have a few hundred plots that I'd like to export to one document. pdf() isn't an option, because the file created is prohibitively huge (due to scatter plots with many points). So I have to use png() instead, but then I end up with a lot of files (would prefer just one). 1. Is there a way to have pdf() embed images, instead of vector instructions? (What would have to be changed/added, and where? I'd consider that a very useful feature.) 2. Does anyone have a script for importing many images (png, bitmap, jpg) into one PDF file? I'd prefer something that works both on Windows and GNU. Thank you, 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 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] mcmcsamp and variance ratios
On Jan 4, 2007, at 11:18 AM, Douglas Bates wrote: On 1/3/07, Martin Henry H. Stevens [EMAIL PROTECTED] wrote: Hi folks, I have assumed that ratios of variance components (Fst and Qst in population genetics) could be estimated using the output of mcmcsamp (the series on mcmc sample estimates of variance components). What I have started to do is to use the matrix output that included the log(variances), exponentiate, calculate the relevant ratio, and apply either quantile or or HPDinterval to get confidence intervals. This seems too simple but I can't think of what is wrong with it. Why bother exponentiating? I'm not sure what ratios you want but if they are ratios of two of the variances that are columns of the matrix then you just need to take the difference of the logarithms. I expect that the quantiles and HPDintervals would be better behaved, in the sense of being based on a distribution that is close to symmetric, on the scale of the logarithm of the ratio instead of the ratio itself. Quantiles calculated for the logarithm of the ratio will map to quantiles of the ratio. However, if you really do feel that you must report an HPDinterval on the ratio then you would need to exponentiate the logarithm of the ratio before calculating the interval. Technically the HPD interval of the ratio is not the same as exponentiating the end points of the HPDinterval of the logarithm of the ratio but I doubt that the differences would be substantial. My collaborator (the evolutionary biologist on this project) is very skeptical of the results I have been providing. Most of the Qst ratios, Qst = Var[population] / ( Var[population] + Var[genotype] ) have values close to 0.5 (0.45--0.55) and wider confidence intervals (e.g. 0.2--0.8) than they have tended to see in the literature. I suspect that this derives from our tiny sample sizes: 24 genotypes total, distributed among 9 populations (2-3 genotypes within each population). Our variances (shrinkage estimates) frequently do not differ from zero. My model building using AIC results in the removal of most of the variance components. We only stuck the terms back in the model in order to get SOME number for these. The biologist (supported by a biometrician) wants to bootstrap or jackknife the models. I will be very skeptical if all of a sudden they get qualitatively different estimates and intervals. Does my perspective make sense? All comments appreciated. -Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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] Install RMySQL with R 2.4.0
All, I am glad all of you have benefited from the posting of the RMySQL 5-10 zip file on my university website. I am asking for some help from the group, I am leaving the university at the end of the semester and I need a place to post this file until I get settled in my new position. Anyone that can help me or us out with this. It would be greatly appreciated. Thank you Joe Frank McCown wrote: Joe Byers wrote: All, After staring at this error message for an hour or so yesterday and this morning. I decided to try something else. Low and behold trying to build the package in cygwin causes R to try and build under linux/unix not windows. I went to the command prompt and was able to build the package. Download the RMySQL...tar.gz file and unzip somewhere like drive:/projects Several notes 1. make sure you have mysql directories on your computer somewhere with the subdirs of include, bin, and lib. You can just copy these from you actual server unless you want to install them. I used d:/mysql/... 2. Modify configure.win in RMySQL and Makevars.win ins RMySQL/src to have the mysql directories from (1) 3. Copy and paste this script to a batch file and execute ** Rem build without --docs=normal tries to build chm help on windows this bombs Rem if a zip program not installed the zip file will not be built Rem go find the temp directory where R built the package and copy to ../R/library Rem temp directory will look something like C:\Temp\Rinst32098657\RMySQL Rem if R bin directory in the path this will run otherwise add the drive:\Dir1\R\bin to the command Rcmd build --binary \projects\RMySQL --docs=normal *** 4. Note that I have --docs=normal in the command line. This is needed to get the package built. Windows packages now default to chm files and RMySQL does not have any windows chm help files. All txt, html, and latex help are built with this option. 5. I am not sure where the RMySQL...zip file is stored, I think in ...R\Bin. I just copied the files from the temp\RinstXX\to the ...\R\library to install. This may or may not work for you, it did for me. I will try and update my website www.cba.utulsa.edu/byersj Research and Analytics section to include a link to the RMySQL zip file for others to download. Good Luck Joe Joe, Thanks for telling us how you got RMySQL installed. Would you mind posting the dll files so the rest of us wouldn't have to recompile anything? Thanks, Frank __ 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] setting new working directories
On 1/4/2007 12:48 PM, Duncan Murdoch wrote: On 1/4/2007 9:41 AM, Bill Shipley wrote: Hello, and Happy New Year. My default working directory is getting very cluttered. I know that I should be using a different working directory for each project (I work in Windows), but do not know how to go about creating different ones and moving back and forth between them. I have read Venables Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of date with respect to this topic and have searched through the documentation but cannot find a clear explanation for doing this. Can someone point me to the proper documentation for creating and using different working directories from within Windows (please, no comments about switching to UNIX...). I don't think R has facilities for creating directories: you would do that in the OS, e.g. in Windows Explorer, right click and ask for New | Folder. A couple of people have pointed out dir.create() to me. I would have found it with help.search('directory') Duncan Murdoch In Windows the easiest way to set a directory as the current working directory is setwd(choose.dir()) In the choose.dir dialog you can type the directory name in standard Windows format (don't worry about escaping \), or you can use the directory browser to choose it. By the way, if you do decide to switch to Unix, you'll have to do without choose.dir() (unless it's in a contributed package somewhere). Duncan Murdoch __ 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] littler+dget+stdin - segmentation fault
Hi, I'm trying to write a series of pipes using littler, and I get the following behaviour: Sorry if I'm just doing something witless, I'm new to R. I'm using the latest versions from debian testing (2.4.0 and 0.0.8). $ r -e 'a-dget(file=stdin()); print(a)' ?list(a=2) Segmentation fault In R itself this works: dget(file=stdin()) ?list(a=2) $a [1] 2 As do (from the command line): $ cat foo list(a=2) $ r -e 'a-dget(file=foo); print(a)' $a [1] 2 and (using littler and scan instead of dget) $ r -e 'a-scan(file=stdin()); print(a)' Thanks in advance, John. -- Contractor in Cambridge UK -- http://www.aspden.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] loess
Hi, I have tried for (i in 1:100) L[,i] - loess((i = =(1:100))~I(1:100), span=.5, degree=1)$fit to create a matrix which gives me the smoothing weights (correctly as far as I have experienced), eg. yhat - loess(y~I(1:100), span=.5,degree=1)$fit yhat[30] [1] -0.2131983 L[30,]%*%y [,1] [1,] -0.2131983 But, L[30,] has 56 nonzero coefficients, not 50 that I expect with span = 0.5. Actually the number of nonzero elements on rows varies being 49, 50, 55 or 56. Does anyone know why? Jukka Nyblom __ 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] stratified sampling from known population datafile
Dear R-wizards, I have a population from which I want to draw a stratified sample by region. In Venables and Ripley Modern Applied statistics with S I found some great procedures for Simple Random Sampling (with and without replacement) and for Systematic sampling and it works! For stratified sampling I referred to the manual of the survey package.Are there any other papers available on this subject? Is the output correct? And how can I draw a random (stratified by region) sample from my (population) datafile bmi? dstrat-svydesign(id=~1,strata=~REGIONCH, data=bmi) Warning in svydesign(id = ~1, strata = ~REGIONCH, data = bmi) : No weights or probabilities supplied, assuming equal probability summary(dstrat) Stratified Independent Sampling design (with replacement) svydesign(id = ~1, strata = ~REGIONCH, data = bmi) Probabilities: Min. 1st Qu. MedianMean 3rd Qu.Max. 1 1 1 1 1 1 Stratum Sizes: Brussels Flanders Walloonia obs 2571 2987 3006 design.PSU 2571 2987 3006 actual.PSU 2571 2987 3006 Data variables: [1] ID WFIN HH REGION EDU3 FA3 [7] TA2 AGE7 SEX VOEG BMI LNBMI [13] LNVOEG FLA BRU WAL AGEGR1 AGEGR2 [19] AGEGR3 AGEGR4 AGEGR5 AGEGR6 AGEGR7 EDUPRIM [25] EDUSEC EDUHIGH INCLOW INCMED INCHIG REGIONCH [31] PROVINCE SGP GHQ12GHQBIN svymean(~BMI, dstrat) mean SE BMI NA NA Thanks in advance!! Kind regards, Steven Gorle __ 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] memory limits in R loading a dataset and using the package tree
I think the question is discussed in other thread, but I don't exactly find what I want . I'm working in Windows XP with 2GB of memory and a Pentium 4 - 3.00Ghx. I have the necessity of working with large dataset, generally from 300,000 records to 800,000 (according to the project), and about 300 variables (...but a dataset with 800,000 records could not be large in your opinion...). Because of we are deciding if R will be the official software in our company, I'd like to say if the possibility of using R with these datasets depends only by the characteristics of the engine (memory and processor). In this case we can improve the machine (for example, what memory you reccomend?). For example, I have a dataset of 200,000 records and 211 variables but I can't load the dataset because R doesn't work : I control the loading procedure (read.table in R) by using the windows task-manager and R is blocked when the file paging is 1.10 GB. After this I try with a sample of 100,000 records and I can correctly load tha dataset, but I'd like to use the package tree, but after some seconds ( I use this tree(variable1~., myDataset) ) I obtain the message Reached total allocation of 1014Mb. I'd like your opinion and suggestion, considering that I could improve (in memory) my computer. pestalozzi [[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] randomForest and missing data
Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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-pkgs] RSQLite 0.4-18 sent to CRAN
A new version of RSQLite has been pushed to CRAN. In this version... * Further integration of the manifest type system available since SQLite 3. We now obtain the column type from the DB instead of pulling everything across as a character vector and calling type.convert. This should improve performance and provide a more reliable interface to build on top of. Note, however, that since type.convert is no longer called, return values will be different. In particular, text columns will come across as text, not factor. * dbWriteTable has been refactored and no longer uses temp files. This resolves performance issues and line ending quandries on Windows. * Fix for a bug in dbWriteTable when used to import text files; files lacking a trailing end of line marker can now be used. Questions? Send them to the r-sig-db mailing list. Best Wishes, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Weighting Data
Hi All, Weighting is the procedure to correct the distributions in the sample data to approximate those of the population from which it is drawn. This is partly a matter of expansion and partly a matter of correction or adjustment for both non response and non coverage. It serves the purpose of providing data that look like the population rather than like the sample. The Questions is: Can anyone help me with an small example how to weight data in a survey on Gender,Age ( considering two variable) at a time. (in R) Gender 2 2 1 2 2 Age 61 32 35 26 25 Thanks and Regards, Pratap [[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] problem with plot() and POSIXt dates
Hy all, I'm plotting graphs using plot() function, they are on X axes POSIX dates: POSIXt oldClass POSIXct POSIXlt I can't figure out why sometimes it prints the month and days and sometimes it prints the unix timestamp. It appens usually when the xlim is short like only some days. xlim is settled as a POSIXt like this 2006-12-30 17:25:44 CET 2007-01-02 03:16:51 CET On the graph it prints : 116750 and 116770 instead of dates. And the result gives a x axes in unix timestamps as if the plot function didn't recognize that it is a timestamp but just an integer. What am i missing, since R sees itself that it is time stamps and not integer when xlim is enougth large, how do i tell the plot function to see these numbers as POSIXt? thks. [[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] importing timestamp data into R
I have a set of timestamp data that I have in a text file that I would like to import into R for analysis. The timestamps are formated as follows: DT_1,DT_2 [2006/08/10 21:12:14 ],[2006/08/10 21:54:00 ] [2006/08/10 20:42:00 ],[2006/08/10 22:48:00 ] [2006/08/10 20:58:00 ],[2006/08/10 21:39:00 ] [2006/08/04 12:15:24 ],[2006/08/04 12:20:00 ] [2006/08/04 12:02:00 ],[2006/08/04 14:20:00 ] I can get them into R but I cannot figure out how to convert them into something R will recognize as a date/time. I have tried using as.Date, strptime, and chron. Any help would be appreciated? best, Spencer On 1/4/07, Darin A. England [EMAIL PROTECTED] wrote: Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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. [[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.
Re: [R] randomForest and missing data
I don't know about this module, but a general answer is that if you have missing data, it may affect your model. If your data is missing at random, then you might be lucky in your model building. If however your data was not missing at random (e.g. censoring) , you might build a wrong predictor. Missing at random or not, that is a question you should answer and deal with before modeling. I refer you to a book like Analysis of Incomplete Multivariate data. By Schafer If there is a way around that with randomForest, I'd be interested to know too. Hugues Sicotte -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Darin A. England Sent: Thursday, January 04, 2007 3:13 PM To: r-help@stat.math.ethz.ch Subject: [R] randomForest and missing data Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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] Some Windows code for GUI-izing workspace loading
Folks: Motivated by the recent thread on setting working directories, below are a couple of functions for GUI-izing saving and loading files **in Windows only** that sort of takes care of this automatically. The simple strategy is just to maintain a file consisting of the filenames of recently saved workspace (.Rdata, etc.)files. Whenever I save a workspace via the function mySave() below, the filename is chosen via a standard Windows file browser, and the filename where the workspace was saved is added to the list if it isn't already there. The recent() function then reads this file and brings up a GUI standard Windows list box (via select.list()) of the first k filenames (default k = 10) to load into the workspace **and** sets the working directory to that of the first file loaded (several can be brought in at once). I offer these functions with some trepidation: they are extremely simple and unsophisticated, and you definitely use them at your own risk. There is no checking nor warning for whether object names in one loaded file duplicate and hence overwrite those in another when more than one is loaded, for example. Nevertheless, I have found the functions handy, as I use the recently used files options on all my software all the time and wanted to emulate this for R. Suggestions for improvement (or better yet, code!) or information about bugs or other stupidities gratefully appreciated. Cheers, Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 Code Follows # mySave- function(recentlistFile=paste(c:/Program Files/R,recentFiles.txt,sep=/), savePlots=FALSE) { ## DESCRIPTION: ## Use a windows GUI to save current workspace ## ARGUMENTS: ##recentlistFile: a quoted character string giving the full pathname/filename to ## the file containing the listof recent files. ## This must be the same as the filename argument of recent() ##The default saves the file in the global R program directory, which means it does not ##have to be changed when updating to new versions of R which I store under ##the global R directory. You may need to change this if you have a different ##way of doing things. ## ## ##savePlots: logical. Should the .SavedPlots plot history be saved? This object can ##be quite large and not saving it often makes saving and loading much faster, ##as well as avoiding memory problems. The default is not to save. if(!savePlots) if(exists(.SavedPlots,where=1))rm(.SavedPlots,pos=1) fname-choose.files(caption='Save As...',filters=Filters['RData',],multi=FALSE) if(fname!=){ save.image(fname) if(!file.exists(recentlistFile))write(fname,recentlistFile,ncol=1) else{ nm-scan(recentlistFile,what=,quiet=TRUE,sep=\n) ## remove duplicate filenames and list in LIFO order write(unique(c(fname,nm)),recentlistFile,ncol=1) } } else cat('\nWorkspace not saved\n') } recent- function(filename=paste(c:/Program Files/R,recentFiles.txt,sep=/),nshow=10, setwork=TRUE) { ## DESCRIPTION: ## GUI-izes workspace loading by bringing up a select box of files containing ## recently saved workspaces to load into R. ## ARGUMENTS: ## file: character. The full path name to the file containing the file list, ## which is a text file with the filenames, one per line. ## ## ## nshow: The maximum number of paths to show in the list ## ## setwork: logical. Should the working directory be set to that of the first file ## loaded? ## find the file containing the filenames if it exists if(!file.exists(filename)) stop(File containing recent files list cannot be found.) filelist-scan(filename,what=character(),quiet=TRUE,sep='\n') len-length(filelist) if(!len)stop(No recent files) recentFiles-select.list(filelist[1:min(nshow,len)],multiple=TRUE) if(!length(recentFiles))stop(No files selected) i-0 for(nm in recentFiles){ if(file.exists(nm)){ load(nm,env=.GlobalEnv) i-i+1 if(i==1 setwork)setwd(dirname(nm)) } else cat('\nFile',nm,'not found.\n') } cat('\n\n',i,paste(' file',ifelse(i==1,'','s'),' loaded\n',sep=)) } __ 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] randomForest and missing data
Yes I completely agree with your statements. As far as a way around it, I would say that CART has some facilities for dealing with missing data. e.g. when an observation is dropped into the tree and encounters a split at which the variable is missing, then one option is to simply not send it further down the tree. One may then obtain a prediction for that interior node, albeit probably not a very good one, but it is one way to handle cases with missing values. So, my thought is that why can't we simply have that capability with randomForest as well? Darin On Thu, Jan 04, 2007 at 03:44:27PM -0600, Sicotte, Hugues Ph.D. wrote: I don't know about this module, but a general answer is that if you have missing data, it may affect your model. If your data is missing at random, then you might be lucky in your model building. If however your data was not missing at random (e.g. censoring) , you might build a wrong predictor. Missing at random or not, that is a question you should answer and deal with before modeling. I refer you to a book like Analysis of Incomplete Multivariate data. By Schafer If there is a way around that with randomForest, I'd be interested to know too. Hugues Sicotte -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Darin A. England Sent: Thursday, January 04, 2007 3:13 PM To: r-help@stat.math.ethz.ch Subject: [R] randomForest and missing data Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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] importing timestamp data into R
Try this: Lines - DT_1,DT_2 [2006/08/10 21:12:14 ],[2006/08/10 21:54:00 ] [2006/08/10 20:42:00 ],[2006/08/10 22:48:00 ] [2006/08/10 20:58:00 ],[2006/08/10 21:39:00 ] [2006/08/04 12:15:24 ],[2006/08/04 12:20:00 ] [2006/08/04 12:02:00 ],[2006/08/04 14:20:00 ] Lines2 - gsub(\\[|\\], , readLines(textConnection(Lines))) # using chron library(chron) DT - read.csv(textConnection(Lines2)) DT[] - lapply(DT, function(x) chron(substring(x, 1, 10), substring(x, 12), format = c(Y/M/D, h:m:s))) DT # using POSIXct DT - read.csv(textConnection(Lines2)) DT[] - lapply(DT, as.POSIXct) DT On 1/4/07, sj [EMAIL PROTECTED] wrote: I have a set of timestamp data that I have in a text file that I would like to import into R for analysis. The timestamps are formated as follows: DT_1,DT_2 [2006/08/10 21:12:14 ],[2006/08/10 21:54:00 ] [2006/08/10 20:42:00 ],[2006/08/10 22:48:00 ] [2006/08/10 20:58:00 ],[2006/08/10 21:39:00 ] [2006/08/04 12:15:24 ],[2006/08/04 12:20:00 ] [2006/08/04 12:02:00 ],[2006/08/04 14:20:00 ] I can get them into R but I cannot figure out how to convert them into something R will recognize as a date/time. I have tried using as.Date, strptime, and chron. Any help would be appreciated? best, Spencer On 1/4/07, Darin A. England [EMAIL PROTECTED] wrote: Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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. [[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 grahics: Save as hangs computer
Hello, thanks for the advice. I was aware that the version was out of date and your message prompted me to finally upgrade to the latest version 2.4.1. Unfortunately, running R under Emacs ESS, the problem I described earlier persists. I have also tried the Save as option under the standard RGui interface and this worked in both the old and the new versions of R, 2.3.0 and 2.4.1 respectively. The problem seems to be associated with Emacs ESS. However I don't have a clue where to start in order to find a solution. In general I quite like using Emacs ESS. It provides syntax highlighting and this makes scripts far easier to read than with the standard editor that comes with RGui. I would be grateful for any further hints from someone who has encountered similar problems in running R 2.4.1 through Emacs ESS 5.3.3 under Windows 2000. Regards Karl |-+ | | [EMAIL PROTECTED]| | | .ca | | || | | 04/01/2007 10:10 | | || |-+ --| | | | To: [EMAIL PROTECTED] | | cc: r-help@stat.math.ethz.ch | | Subject: Re: [R] R grahics: Save as hangs computer | --| On 1/3/2007 5:30 PM, [EMAIL PROTECTED] wrote: Hello list, I have encountered a problem trying to save graphs using the R-graphics menu: File|Save as. The menu suggests that files may be saved as either Metafile, Postscript, pdf, png, bmp, jpeg. When I specify any of those file formats a menu comes up requesting a file name. After providing a name R invariably hangs and has to be restarted. I am able to save files under the various formats using the command line without problems. However, sometimes it would be convenient to use the menus. I was wondering if anyone else had encountered a similar behaviour and had found a remedy. I am running are under GNU-Emacs ESS 5.3.3. sessionInfo() Version 2.3.0 (2006-04-24) That version is out of date. Could you please update to the current version (2.4.1), and see if the problem persists? If so, could you please try it when running Rterm or Rgui on its own, rather than running under Emacs? Thanks. Duncan Murdoch i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: lattice 0.13-8 Regards Karl _ Dr Karl J Sommer, Department of Primary Industries, Catchment Agriculture Services, PO Box 905 Mildura, VIC, 3502 Australia Tel: +61 (0)3 5051 4390 Fax +61 (0)3 5051 4534 Email: [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] A question on REML in R
Hello, everyone, I'm using R to deal with a REML problem. I found lmer is the right function for this. But I got stuck because I couldn't interpret the result. I'm attaching a short example of my executing log. Please have a look and give me some advice on it. Thanks a lot! Plot Block Treatment Data 1 12 7.8 2 11 5.9 3 1310.3 4 2310.9 5 22 8.9 6 21 7.2 7 3211.1 8 3312.8 9 31 9.1 10 41 9.8 11 4212.2 12 4314.0 anova(lm(Data~as.factor(Treatment)+as.factor(Block))) Analysis of Variance Table Response: Data Df Sum Sq Mean Sq F valuePr(F) as.factor(Treatment) 2 32.000 16.000 282.35 1.162e-06 *** as.factor(Block) 3 30.000 10.000 176.47 3.066e-06 *** Residuals 6 0.340 0.057 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 lmer(Data~Treatment+(Treatment|Block)) Linear mixed-effects model fit by REML Formula: Data ~ Treatment + (Treatment | Block) AIC BIC logLik MLdeviance REMLdeviance 28.68 31.1 -9.339 16.8818.68 Random effects: Groups NameVariance Std.Dev. Corr Block(Intercept) 3.3116e+00 1.8198e+00 Treatment 2.4303e-11 4.9298e-06 0.000 Residual 4.8606e-02 2.2047e-01 number of obs: 12, groups: Block, 4 Fixed effects: Estimate Std. Error t value (Intercept) 6.00.92533 6.484 Treatment2.00.07795 25.658 Correlation of Fixed Effects: (Intr) Treatment -0.168 Warning message: Estimated variance-covariance for factor 'Block' is singular in: `LMEoptimize-`(`*tmp*`, value = list(maxIter = 200, tolerance = 1.49011611938477e-08, Charmy _ Communicate instantly! Use your Hotmail address to sign into Windows Live Messenger now. http://get.live.com/messenger/overview __ 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] littler+dget+stdin - segmentation fault
John Lawrence Aspden wrote: Hi, I'm trying to write a series of pipes using littler, and I get the following behaviour: Sorry if I'm just doing something witless, I'm new to R. I'm using the latest versions from debian testing (2.4.0 and 0.0.8). $ r -e 'a-dget(file=stdin()); print(a)' ?list(a=2) Segmentation fault You've found a bug which has been fixed. Expect a new version 0.0.9 of littler later tonight from here: http://dirk.eddelbuettel.com/code/littler/ and soon after than in debian. What exactly are you trying to accomplish? Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] randomForest and missing data
You can try randomForest in Fortran codes, which has that function doing missing replacement automatically. There are two ways of imputations (one is fast and the other is time-consuming) to do that. I did it long time ago. the link is below. If you have any question, just let me know. http://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm In principle, each individual tree is NOT a cart tree since each splitting predictor is randomly selected. In my impression, rf is more like nearest neighbor algorithm. The surrogation is NOT used in rf implementation. That's why you have to impute it before using it; while the imputation is not implemented in r-version, in my best knowledge. You can check that from reading the original technical report or some presentation by original authors. I remember there was some slide comparing rf and CART somewhere. HTH, weiwei On 1/4/07, Darin A. England [EMAIL PROTECTED] wrote: Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ 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 grahics: Save as hangs computer
The good news, you don't have to shut down R. Several control-G in the *R* buffer in emacs will recover control. A second attempt in the same GUI graphics device did get the postscript file saved. A workaround for this problem is to use the command line, rather than the GUI menu, to save the file. This line dev.copy2eps() works. I discovered that it is necessary to set options(chmhelp=FALSE) when running R from emacs as the chmhelp is also freezing R and the help system. I am using R-2.4.1 on Windows. Use ?dev.copy2eps for details on the command line dev.* commands. Follow-up should go to the ess-bugs mailing list. Rich __ 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] memory limits in R loading a dataset and using the package tree
Please read the rw-FAQ Q2.9. There are ways to raise the limit, and you have not told us that you used them (nor the version of R you used, which matters as the limits are version-specific). Beyond that, there are ways to use read.table more efficiently: see its help page and the 'R Data Import/Export' manual. In particular, did you set nrows and colClasses? But for the size of problem you have I would use a 64-bit build of R. On Thu, 4 Jan 2007, domenico pestalozzi wrote: I think the question is discussed in other thread, but I don't exactly find what I want . I'm working in Windows XP with 2GB of memory and a Pentium 4 - 3.00Ghx. I have the necessity of working with large dataset, generally from 300,000 records to 800,000 (according to the project), and about 300 variables (...but a dataset with 800,000 records could not be large in your opinion...). Because of we are deciding if R will be the official software in our company, I'd like to say if the possibility of using R with these datasets depends only by the characteristics of the engine (memory and processor). In this case we can improve the machine (for example, what memory you reccomend?). For example, I have a dataset of 200,000 records and 211 variables but I can't load the dataset because R doesn't work : I control the loading procedure (read.table in R) by using the windows task-manager and R is blocked when the file paging is 1.10 GB. After this I try with a sample of 100,000 records and I can correctly load tha dataset, but I'd like to use the package tree, but after some seconds ( I use this tree(variable1~., myDataset) ) I obtain the message Reached total allocation of 1014Mb. I'd like your opinion and suggestion, considering that I could improve (in memory) my computer. pestalozzi [[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. -- 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] problem with plot() and POSIXt dates
As the footer says PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. We can't help you with a problem we cannot reproduce, and random guessing is not going to be productive. On Thu, 4 Jan 2007, COMTE Guillaume wrote: Hy all, I'm plotting graphs using plot() function, they are on X axes POSIX dates: POSIXt oldClass POSIXct POSIXlt I can't figure out why sometimes it prints the month and days and sometimes it prints the unix timestamp. It appens usually when the xlim is short like only some days. xlim is settled as a POSIXt like this 2006-12-30 17:25:44 CET 2007-01-02 03:16:51 CET On the graph it prints : 116750 and 116770 instead of dates. And the result gives a x axes in unix timestamps as if the plot function didn't recognize that it is a timestamp but just an integer. What am i missing, since R sees itself that it is time stamps and not integer when xlim is enougth large, how do i tell the plot function to see these numbers as POSIXt? thks. [[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. -- 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] color of opposite sign values in filled.contour
Dear R-helpers, I'm plotting geophysical data in the form of contours using filled.contour. The display would be much more effective if the areas with negative values could be color coded by -- say -- cold colors in the range of blue to green, and conversely the areas with positive values got plotted with warm colors, from yellow to red. Right now if I use a palette spanning the spectrum I need the entire range is associated with the actual range of the data, which can be positively or negatively skewed, and as a result the position of the zero is totally arbitrary. I'm wondering if someone out there has come up with a clever way to set the color scale accordingly, as a function of the actual range of the values in the matrix that is being plotted. Ideally, it would be neat to still use the entire spectrum, but sampling differently the cold and warm subsets accordingly to the extent of the negative and positive values in the data. Also, when I try to play around in an ad hoc fashion with the palette I often get funny results in the legend, with color-scale wrapping or blank cells at one of the extremes. I cannot hack effectively the code of the filled.contour function, obviously... Thank you in advance for your help happy new year claudia tebaldi -- Claudia Tebaldi ISSE/CGD/IMAGe http://www.image.ucar.edu/~tebaldi currently visiting Center for Environmental Science and Policy Stanford University tel: (650) 724-9261 skype: claudia.tebaldi __ 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] loess
On Thu, 4 Jan 2007, Jukka Nyblom wrote: Hi, I have tried for (i in 1:100) L[,i] - loess((i = =(1:100))~I(1:100), span=.5, degree=1)$fit to create a matrix which gives me the smoothing weights (correctly as far as I have experienced), eg. yhat - loess(y~I(1:100), span=.5,degree=1)$fit yhat[30] [1] -0.2131983 L[30,]%*%y [,1] [1,] -0.2131983 But, L[30,] has 56 nonzero coefficients, not 50 that I expect with span = 0.5. Actually the number of nonzero elements on rows varies being 49, 50, 55 or 56. Does anyone know why? loess is a complicated algorithm, and you need to study the background references in depth to fully understand it. In particular, the default is not to do direct fitting (as I guess you are assuming) but interpolation. See ?loess.control. Most descriptions, including the help page, are simplifications. Jukka Nyblom -- 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] littler+dget+stdin - segmentation fault
Jeffrey Horner wrote: John Lawrence Aspden wrote: Hi, I'm trying to write a series of pipes using littler, and I get the following behaviour: $ r -e 'a-dget(file=stdin()); print(a)' ?list(a=2) Segmentation fault You've found a bug which has been fixed. Expect a new version 0.0.9 of littler later tonight from here: http://dirk.eddelbuettel.com/code/littler/ What exactly are you trying to accomplish? Hi Jeff, that's gratifying! Thanks. I'm trying to write some scripts to process the output from a brain scanner, using some routines which someone else wrote to use interactively in R. The idea is to hide R from the end-user so that as far as they're concerned it's just a normal unix filter. Indeed the end-user is probably going to be another program eventually. However the first process is a time consuming wavelet transform and correlation step, and then there are loads of possibilities for what to do with the result. so I want to be able to say: process1 brain.data processed.data (time consuming) to do the hard bit, and then e.g. process2 processed.data process3 processed.data | graphing-tool to produce various visualizations and statistics I'm using dput/dget to read and write the intermediate structure (a list of matrices). All the other methods seem to remember the structure's original name and then stick it in the global namespace, which I find annoying. I also like the fact that dput/dget work with text files, which means that one day I'll be able to drop in a replacement for process1 written in C to deal with anticipated huge data sets. This seems to be working well so far (I'm only prototyping to see if it's feasible), but I'm having to work around the bug by having the file as a command line argument rather than piping it in. Cheers, John. -- Contractor in Cambridge UK -- http://www.aspden.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] color of opposite sign values in filled.contour
Hi Claudia, It's quite easy to do this using ggplot, although you get exactly the same appearance as filled.contour (hopefully in the next version). Have a look at ggtile and scgradient. Regards, Hadley On 1/4/07, Claudia Tebaldi [EMAIL PROTECTED] wrote: Dear R-helpers, I'm plotting geophysical data in the form of contours using filled.contour. The display would be much more effective if the areas with negative values could be color coded by -- say -- cold colors in the range of blue to green, and conversely the areas with positive values got plotted with warm colors, from yellow to red. Right now if I use a palette spanning the spectrum I need the entire range is associated with the actual range of the data, which can be positively or negatively skewed, and as a result the position of the zero is totally arbitrary. I'm wondering if someone out there has come up with a clever way to set the color scale accordingly, as a function of the actual range of the values in the matrix that is being plotted. Ideally, it would be neat to still use the entire spectrum, but sampling differently the cold and warm subsets accordingly to the extent of the negative and positive values in the data. Also, when I try to play around in an ad hoc fashion with the palette I often get funny results in the legend, with color-scale wrapping or blank cells at one of the extremes. I cannot hack effectively the code of the filled.contour function, obviously... Thank you in advance for your help happy new year claudia tebaldi -- Claudia Tebaldi ISSE/CGD/IMAGe http://www.image.ucar.edu/~tebaldi currently visiting Center for Environmental Science and Policy Stanford University tel: (650) 724-9261 skype: claudia.tebaldi __ 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 grahics: Save as hangs computer
On 1/4/2007 5:33 PM, [EMAIL PROTECTED] wrote: Hello, thanks for the advice. I was aware that the version was out of date and your message prompted me to finally upgrade to the latest version 2.4.1. Unfortunately, running R under Emacs ESS, the problem I described earlier persists. I have also tried the Save as option under the standard RGui interface and this worked in both the old and the new versions of R, 2.3.0 and 2.4.1 respectively. The problem seems to be associated with Emacs ESS. However I don't have a clue where to start in order to find a solution. There may be other Emacs implementations available on Windows; if so, I'd try one of those. If that doesn't work, you could try filing this as an Emacs bug report, but I suspect that it won't get fixed. Your best choice may be to abandon Windows or Emacs. Duncan Murdoch In general I quite like using Emacs ESS. It provides syntax highlighting and this makes scripts far easier to read than with the standard editor that comes with RGui. I would be grateful for any further hints from someone who has encountered similar problems in running R 2.4.1 through Emacs ESS 5.3.3 under Windows 2000. Regards Karl |-+ | | [EMAIL PROTECTED]| | | .ca | | || | | 04/01/2007 10:10 | | || |-+ --| | | | To: [EMAIL PROTECTED] | | cc: r-help@stat.math.ethz.ch | | Subject: Re: [R] R grahics: Save as hangs computer | --| On 1/3/2007 5:30 PM, [EMAIL PROTECTED] wrote: Hello list, I have encountered a problem trying to save graphs using the R-graphics menu: File|Save as. The menu suggests that files may be saved as either Metafile, Postscript, pdf, png, bmp, jpeg. When I specify any of those file formats a menu comes up requesting a file name. After providing a name R invariably hangs and has to be restarted. I am able to save files under the various formats using the command line without problems. However, sometimes it would be convenient to use the menus. I was wondering if anyone else had encountered a similar behaviour and had found a remedy. I am running are under GNU-Emacs ESS 5.3.3. sessionInfo() Version 2.3.0 (2006-04-24) That version is out of date. Could you please update to the current version (2.4.1), and see if the problem persists? If so, could you please try it when running Rterm or Rgui on its own, rather than running under Emacs? Thanks. Duncan Murdoch i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: lattice 0.13-8 Regards Karl _ Dr Karl J Sommer, Department of Primary Industries, Catchment Agriculture Services, PO Box 905 Mildura, VIC, 3502 Australia Tel: +61 (0)3 5051 4390 Fax +61 (0)3 5051 4534 Email: [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-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 grahics: Save as hangs computer
Just in case you were not already aware, you could try Tinn-R (http://www.sciviews.org/Tinn-R/) or JGR (http://rosuda.org/JGR/) or one of the editors described at this site (http://www.sciviews.org/_rgui/projects/Editors.html) as Emacs alternatives. I love Emacs and miss the speed of using Emacs keystrokes to navigate the files, but the other editors do offer easier access to command syntax help among other things. I found that I ended up crashing Emacs-ESS-R a lot on Windows XP and so now I use Tinn-R. -S. Quoting Duncan Murdoch [EMAIL PROTECTED]: On 1/4/2007 5:33 PM, [EMAIL PROTECTED] wrote: Hello, thanks for the advice. I was aware that the version was out of date and your message prompted me to finally upgrade to the latest version 2.4.1. Unfortunately, running R under Emacs ESS, the problem I described earlier persists. I have also tried the Save as option under the standard RGui interface and this worked in both the old and the new versions of R, 2.3.0 and 2.4.1 respectively. The problem seems to be associated with Emacs ESS. However I don't have a clue where to start in order to find a solution. There may be other Emacs implementations available on Windows; if so, I'd try one of those. If that doesn't work, you could try filing this as an Emacs bug report, but I suspect that it won't get fixed. Your best choice may be to abandon Windows or Emacs. Duncan Murdoch In general I quite like using Emacs ESS. It provides syntax highlighting and this makes scripts far easier to read than with the standard editor that comes with RGui. I would be grateful for any further hints from someone who has encountered similar problems in running R 2.4.1 through Emacs ESS 5.3.3 under Windows 2000. Regards Karl |-+ | | [EMAIL PROTECTED]| | | .ca | | || | | 04/01/2007 10:10 | | || |-+ --| | | | To: [EMAIL PROTECTED] | | cc: r-help@stat.math.ethz.ch | | Subject: Re: [R] R grahics: Save as hangs computer | --| On 1/3/2007 5:30 PM, [EMAIL PROTECTED] wrote: Hello list, I have encountered a problem trying to save graphs using the R-graphics menu: File|Save as. The menu suggests that files may be saved as either Metafile, Postscript, pdf, png, bmp, jpeg. When I specify any of those file formats a menu comes up requesting a file name. After providing a name R invariably hangs and has to be restarted. I am able to save files under the various formats using the command line without problems. However, sometimes it would be convenient to use the menus. I was wondering if anyone else had encountered a similar behaviour and had found a remedy. I am running are under GNU-Emacs ESS 5.3.3. sessionInfo() Version 2.3.0 (2006-04-24) That version is out of date. Could you please update to the current version (2.4.1), and see if the problem persists? If so, could you please try it when running Rterm or Rgui on its own, rather than running under Emacs? Thanks. Duncan Murdoch i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: lattice 0.13-8 Regards Karl _ Dr Karl J Sommer, Department of Primary Industries, Catchment Agriculture Services, PO Box 905 Mildura, VIC, 3502 Australia Tel: +61 (0)3 5051 4390 Fax +61 (0)3 5051 4534 Email: [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-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
[R] coefficients of each local polynomial from loess() or locfit()
I want to extract estimated coeffiicents of each local polynomial at given x from loess(), locfit(), or KernSmooth(). Can some experts provide me with suggestions? Thanks. Delong Liu __ 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] ifelse on data frames
[Using R 2.2.0 on Windows XP; OK, OK, I will update soon!] I have noticed some undesirable behaviour when applying ifelse to a data frame. Here is my code: A - scan() 1.00 0.00 0.00 0 0.0 0.027702 0.972045 0.000253 0 0.0 A - matrix(A,nrow=2,ncol=5,byrow=T) A == 0 ifelse(A==0,0,-A*log(A)) A - as.data.frame(A) ifelse(A==0,0,-A*log(A)) and this is the output: A - scan() 1: 1.00 0.00 0.00 0 0.0 6: 0.027702 0.972045 0.000253 0 0.0 11: Read 10 items A - matrix(A,nrow=2,ncol=5,byrow=T) A == 0 [,1] [,2] [,3] [,4] [,5] [1,] FALSE TRUE TRUE TRUE TRUE [2,] FALSE FALSE FALSE TRUE TRUE ifelse(A==0,0,-A*log(A)) [,1] [,2][,3] [,4] [,5] [1,] 0. 0. 0.000 [2,] 0.09934632 0.02756057 0.00209537700 A - as.data.frame(A) ifelse(A==0,0,-A*log(A)) [[1]] [1] 0. 0.09934632 [[2]] [1]NaN 0.02756057 [[3]] [1] 0 [[4]] [1] NaN NaN [[5]] [1] 0 [[6]] [1] 0. 0.09934632 [[7]] [1] 0 [[8]] [1] 0 [[9]] [1] 0 [[10]] [1] 0 Is this a bug or a feature? Can the behaviour be explained? Regards, Murray Jorgensen -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wkHome +64 7 825 0441Mobile 021 1395 862 __ 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] Fwd: Re: R grahics: Save as hangs computer
Can you send ess-bugs some reproducible examples of what isn't working? These are things that are probably easily fixed. Rich Original message Date: Thu, 04 Jan 2007 21:02:17 -0500 From: [EMAIL PROTECTED] Subject: Re: [R] R grahics: Save as hangs computer To: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Just in case you were not already aware, you could try Tinn-R (http://www.sciviews.org/Tinn-R/) or JGR (http://rosuda.org/JGR/) or one of the editors described at this site (http://www.sciviews.org/_rgui/projects/Editors.html) as Emacs alternatives. I love Emacs and miss the speed of using Emacs keystrokes to navigate the files, but the other editors do offer easier access to command syntax help among other things. I found that I ended up crashing Emacs-ESS-R a lot on Windows XP and so now I use Tinn-R. -S. __ 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] color of opposite sign values in filled.contour
Get the RColorBrewer package from CRAN Description: The packages provides palettes for drawing nice maps shaded according to a variable. __ 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 grahics: Save as hangs computer
Hello list thanks for that advice Rich. You are right a few control-G allowed me to recover and it had saved an eps file. The dev.copy2eps appears to take exactly what is visible in the graphics window and convert it to an eps file. This does the job for the moment. Opening the eps file in GSview I noticed that there is still a lot of white space in the bounding box which creates empty space when I want to include the image into a tex document. Is there a way to crop the image to remove the white space before including it in a document? Cheers Karl |-+ | | [EMAIL PROTECTED] | | || | | 05/01/2007 10:03 | | || |-+ --| | | | To: [EMAIL PROTECTED], [EMAIL PROTECTED] | | cc: r-help@stat.math.ethz.ch, [EMAIL PROTECTED] | | Subject: Re: [R] R grahics: Save as hangs computer | --| The good news, you don't have to shut down R. Several control-G in the *R* buffer in emacs will recover control. A second attempt in the same GUI graphics device did get the postscript file saved. A workaround for this problem is to use the command line, rather than the GUI menu, to save the file. This line dev.copy2eps() works. I discovered that it is necessary to set options(chmhelp=FALSE) when running R from emacs as the chmhelp is also freezing R and the help system. I am using R-2.4.1 on Windows. Use ?dev.copy2eps for details on the command line dev.* commands. Follow-up should go to the ess-bugs mailing list. Rich __ 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] Fwd: Re: R grahics: Save as hangs computer
R is actually smarter than that. The bounding box is square. From plot(1:10) dev.copy2eps(file=tmp.eps) The bounding box (which you can see by opening tmp.eps in emacs) is %%BoundingBox: 0 0 517 517 and LaTeX will therefore interpret it correctly. GSview is misleading you since it puts that square region at one end of the rectangle implied by the GSview setting of media at letter or A4. In addition to most likely not needing to crop, there are many ways to crop the image. If cropping is just to get rid of white space, I usually do it in LaTeX by adding some negative space \height{-2in} inside the figure environment. Rich Original message Date: Fri, 5 Jan 2007 14:48:30 +1100 From: [EMAIL PROTECTED] Subject: Re: [R] R grahics: Save as hangs computer To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], r-help@stat.math.ethz.ch Opening the eps file in GSview I noticed that there is still a lot of white space in the bounding box which creates empty space when I want to include the image into a tex document. Is there a way to crop the image to remove the white space before including it in a document? __ 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 grahics: Save as hangs computer
An additional note. You can see the bounding box in the GSview display by clicking Options/Show Bounding Box Rich __ 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 grahics: Save as hangs computer
another note you can clip the GSview to just the bounding box with Options/EPS CCip Rich __ 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] ifelse on data frames
It can be explained. class(A) [1] data.frame length(A) [1] 5 class(A==0) [1] matrix length(A==0) [1] 10 class(-A*log(A)) [1] data.frame length(-A*log(A)) [1] 5 as you can see, the result of A==0 is matrix with length=10, while the result of -A*log(A) is still data.frame with length=5. then, when calling ifelse( [length=10], 0, [length=5] ), internally, the NO(3rd) argument was repeated by rep(-A*log(A),length.out=10) (try this). the result is list with length=10 and each element has 2 sub-elements. So, the return value of A[(A==0)==FALSE] has 2 sub-elements as you get. I think what confusing you is the behavior of A==0. However, when using 'ifelse', I think you should use matrix as the arguments because data.frame is not consistent with the purpose of 'ifelse'. On 1/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [Using R 2.2.0 on Windows XP; OK, OK, I will update soon!] I have noticed some undesirable behaviour when applying ifelse to a data frame. Here is my code: A - scan() 1.00 0.00 0.00 0 0.0 0.027702 0.972045 0.000253 0 0.0 A - matrix(A,nrow=2,ncol=5,byrow=T) A == 0 ifelse(A==0,0,-A*log(A)) A - as.data.frame(A) ifelse(A==0,0,-A*log(A)) and this is the output: A - scan() 1: 1.00 0.00 0.00 0 0.0 6: 0.027702 0.972045 0.000253 0 0.0 11: Read 10 items A - matrix(A,nrow=2,ncol=5,byrow=T) A == 0 [,1] [,2] [,3] [,4] [,5] [1,] FALSE TRUE TRUE TRUE TRUE [2,] FALSE FALSE FALSE TRUE TRUE ifelse(A==0,0,-A*log(A)) [,1] [,2][,3] [,4] [,5] [1,] 0. 0. 0.000 [2,] 0.09934632 0.02756057 0.00209537700 A - as.data.frame(A) ifelse(A==0,0,-A*log(A)) [[1]] [1] 0. 0.09934632 [[2]] [1]NaN 0.02756057 [[3]] [1] 0 [[4]] [1] NaN NaN [[5]] [1] 0 [[6]] [1] 0. 0.09934632 [[7]] [1] 0 [[8]] [1] 0 [[9]] [1] 0 [[10]] [1] 0 Is this a bug or a feature? Can the behaviour be explained? Regards, Murray Jorgensen -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wkHome +64 7 825 0441Mobile 021 1395 862 __ 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] importing timestamp data into R
Suppose that you have the timestamps in a comma seperated text file, times.dat then do tid - read.csv(times.dat, header = TRUE, colClasses = character) # Note the colClasses argument! If not used the columns of tid are factors by default. time.conv - function(x) as.POSIXct(strptime(x, format = [%Y/%m/%d %H:%M:%S ])) # The value of strptime has class POSIXlt and needs to be converted to POSIXct tid2 - tid for (i in 1:2) tid2[,i] - time.conv(tid2[,i]) print(tid2) str(tid2) class(tid2[,1]) Med venlig hilsen Frede Aakmann Tøgersen -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af sj Sendt: 4. januar 2007 22:39 Til: r-help@stat.math.ethz.ch Emne: [R] importing timestamp data into R I have a set of timestamp data that I have in a text file that I would like to import into R for analysis. The timestamps are formated as follows: DT_1,DT_2 [2006/08/10 21:12:14 ],[2006/08/10 21:54:00 ] [2006/08/10 20:42:00 ],[2006/08/10 22:48:00 ] [2006/08/10 20:58:00 ],[2006/08/10 21:39:00 ] [2006/08/04 12:15:24 ],[2006/08/04 12:20:00 ] [2006/08/04 12:02:00 ],[2006/08/04 14:20:00 ] I can get them into R but I cannot figure out how to convert them into something R will recognize as a date/time. I have tried using as.Date, strptime, and chron. Any help would be appreciated? best, Spencer On 1/4/07, Darin A. England [EMAIL PROTECTED] wrote: Does anyone know a reason why, in principle, a call to randomForest cannot accept a data frame with missing predictor values? If each individual tree is built using CART, then it seems like this should be possible. (I understand that one may impute missing values using rfImpute or some other method, but I would like to avoid doing that.) If this functionality were available, then when the trees are being constructed and when subsequent data are put through the forest, one would also specify an argument for the use of surrogate rules, just like in rpart. I realize this question is very specific to randomForest, as opposed to R in general, but any comments are appreciated. I suppose I am looking for someone to say It's not appropriate, and here's why ... or Good idea. Please implement and post your code. Thanks, Darin England, Senior Scientist Ingenix __ 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. [[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.