[R] R-beta: adjusting y-axis scale with multiple lines in plot
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RExcel
Hello- I am a Graduate Assistant for an instructor who has written programs for statistics calculations such as binomial distributions and regressions. The programs had worked with no problem in Excel 2003. Now we are trying to use it with Excel 2007, and we are having some trouble. I have downloaded RandFriends and have ran the binomial distribution process in 2007 Excel and have received an error that says: "Compile error in hidden module: UFDBinomial" However, ther are two demo excel files in the RExcel file called RdemoDens. When I open the first RDemoDens excel file, I can run the processes and they work fine. When I run the second RDemoDens excel file, or a blank excel 2007 file, the processes do not work and I get the error message. I am trying to figure out what is different about the first RDemoDens excel file that allows the calculations to process correctly. I am thinking that something in the macro library in the demo must be different than what is in a blank excel document. I just cannot seem to figure out what it is. One thing that I did notice is that there are two different RExcel files in the RExcel folder. One is labled "RExcel" and one is labed "RExcel 2007." What are the difference between these two RExcel files? I am not sure if this has anything to do with the problem, but perhaps the excel demo in which our calculations work uses the correct RExcel file while a regular excel 2007 document does not call the correct one. If anyone has an idea about what might be happening here, or who else I could ask about the situation, I would appreciate any input. Thanks, Ben Ward [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] gnu ODBC driver for ORACLE in WinXP platform?
On Tue, 6 Oct 2009, Kenneth Roy Cabrera Torres wrote: Hi R users and Dr. Uwe Ligges: I read on the ROracle pre-compiled binary README file that: Hmm, that is from the CRAN README on Windows pre-compiled binary packages: there is no 'ROracle pre-compiled binary' (for Windows or Mac OS X) on CRAN. "Although the package ROracle passes make check, it seems to be dangerous to distribute it: I do not have the software available this package depends on." Why it is dangerous to use ROracle for windows? What software does ROracle depends on in windows platform? Oracle (just like every other platform)! I believe the statement is out-of-date: ROracle seems not to build with current versions of R. But the main issues were (a) It needs to link against Oracle's client software, and that depends on the particular version of Oracle. Bitter experience suggests that you need to build such packages from the sources against the client software installed on your machine to get reliable service from them. (b) The package does no actual tests in its examples. It may appear to build but not work in practice, since nothing is tested in the build process. Is there a GNU solution for an ODBC driver on windows XP platform for ORACLE for use it with RODBC? What does GNU have to do with this? RODBC works with Oracle with Oracle's own Windows drivers, and a test suite for Oracle is in the sources. Now, that has been tested against only a couple of versions of Oracle, but ODBC is a well-documented API and Oracle's ODBC driver writers should always be complying with it. If perchance by 'GNU' you meant 'GPL' or 'Open Source' then - Oracle is proprietary, although there are 'free as in beer' versions. - the most open you can be is to communicate with it via an open API, and ODBC is such (and I think the only one supported by Oracle). Thank you for your help. It does seem churlish to be asking why the hard-working volunteers have *not* provided you with a binary version of a package, and such queries are more common than thanks for those that *are* provided (something like 20x as many). Kenneth -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] power?
The short answer is Yes. If you reject the null hypothesis based on that p-value, then by definition you had enough power to do that. This is because there is a precise inverse relationship between the p-value and the "observed" power, once you fix the effect size and the sample size. In other words, your post-hoc power analysis would be a simple re-statement of the p-value. There is no extra information that can be gained from such an analysis. See: The American Statistician, February 2001, Vol. 55, No. 1, pp 19-24 Don't bother with your power analysis, unless you are planning a new experiment. Simon. On Tue, 2009-10-06 at 13:49 -0700, SNN wrote: > Hi, > > I have used multiple linear regression on a data set and one if the > regressor was significant with a p-value =0.01 > > I need to calculate the power for a multiple linear regression. i.e. do I > have enough power to believe the above p-value? > > > > -- Simon Blomberg, BSc (Hons), PhD, MAppStat. Lecturer and Consultant Statistician School of Biological Sciences The University of Queensland St. Lucia Queensland 4072 Australia Room 320 Goddard Building (8) T: +61 7 3365 2506 http://www.uq.edu.au/~uqsblomb email: S.Blomberg1_at_uq.edu.au Policies: 1. I will NOT analyse your data for you. 2. Your deadline is your problem. Statistics is the grammar of science - Karl Pearson __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] power?
Hi, I have used multiple linear regression on a data set and one if the regressor was significant with a p-value =0.01 I need to calculate the power for a multiple linear regression. i.e. do I have enough power to believe the above p-value? -- View this message in context: http://www.nabble.com/power--tp25776305p25776305.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rpois formula
Hi all, It's been a while since i've used R and I can't remember how to do the following: i have a = rpois (10, x) b = rpois (10, y) what is the code to show that a>b, b>a and a=b to show just the number of occurances? at the moment when I type a>b I get a nice long list of true or false. so i'm hoping to have the following a>b > 35000 b>a > 25000 a=b > 4 thanks in advance -- View this message in context: http://www.nabble.com/rpois-formula-tp25774389p25774389.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R, Coda, and OpenBUGS
Hi All, I am trying to figure out how to use R-Coda with the output from OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS. I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' "bugs" and have used "read.bugs" to build the coda object. I can successfully switch to OpenBugs and run the same model and get the basic summary back. However, I cannot build the coda object. From what I have read "read.openbugs" should do the trick. However, I have discovered the current version of OpenBUGS (v 3.03) doesn't write any output files in spite of setting codaPkg=TRUE in the "bugs" call. "Str(openbugs.object)" reveals a large collection of elements, one of which is an array that contains the MCMC chains. Is there a function to build the coda object? Thanks in advance for any suggestions, Bill Halteman __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] text on a plot
On Oct 6, 2009, at 11:42 PM, Ning Ma wrote: Hi, How can I put text in a figure which is not parallel to the axes,such as along the line x=2y. It seems that the function 'text' does not have such parameters. What about srt? plot(1,1) text(0.8,0.8, "text test", srt=45) thanks in advance Ma __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] text on a plot
I think if you look in the plotrix package you may find what you are looking for. If I remember it is in one of the vignettes or demos. Seems there might have been a Paul Murrell article in R-News that had an illustration of doing that as well. On Oct 6, 2009, at 11:42 PM, Ning Ma wrote: Hi, How can I put text in a figure which is not parallel to the axes,such as along the line x=2y. It seems that the function 'text' does not have such parameters. thanks in advance Ma David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] text on a plot
Hi, How can I put text in a figure which is not parallel to the axes,such as along the line x=2y. It seems that the function 'text' does not have such parameters. thanks in advance Ma __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rpois formula
Or: a = rpois (10, 0.1) b = rpois (10, 0.15) table(a>b, a==b, b>a) And if you look at that output a bit: table(ab, b>a and a=b . # 79049 12712 8239 .. since FALSE < TRUE -- On Oct 6, 2009, at 9:49 PM, Ian Fiske wrote: try sum(a > b) sum(b > a) sum(a == b) Ian nedmt60 wrote: i have a = rpois (10, x) b = rpois (10, y) what is the code to show that a>b, b>a and a=b to show just the number of occurances? occurrences? at the moment when I type a>b I get a nice long list of true or false. As you _should_ when you supply two vectors to a binary operator. -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rpois formula
try sum(a > b) sum(b > a) sum(a == b) Ian nedmt60 wrote: > > i have > > a = rpois (10, x) > b = rpois (10, y) > > what is the code to show that a>b, b>a and a=b to show just the number of > occurances? > at the moment when I type a>b I get a nice long list of true or false. > -- View this message in context: http://www.nabble.com/rpois-formula-tp25774389p25779305.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Vim-R-plugin (new version)
> Dear R users, > > The author of Tinn-R (Jose Claudio Faria) now is co-author of > Vim-R-plugin2, a plugin that makes it possible to send commands > from the Vim text editor to R. We added many new key bindings, > restructured the menu and created new Tool Bar buttons. The new > version is available at: > > http://www.vim.org/scripts/script.php?script_id=2628 > > NOTES: >(1) Some old key binding changed, including the shortcuts >to start R. >(2) The plugin doesn't work on Microsoft Windows yet. With apologies. I think I just sent a blank email to the list. In an ironic twist of fate (since I'm writing about a modal text editor), I hit the wrong button. I've been playing with this for a couple of days and while I'm still getting used to it, this plug-in does offer a compelling alternative to emacs-ess. ESS still has some advantages, but this is a very interesting plugin. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing
I should had put it as a question. On Tue, Oct 6, 2009 at 2:06 PM, Bert Gunter wrote: > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf Of Karl Ove Hufthammer > Sent: Tuesday, October 06, 2009 1:56 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing > > Antonio Paredes skreiv: > > > I'm hoping to get a response from some of the R gurus in this list. Is my > > assumption that R is not designed or build to deal with high levels (a > > lots of simulated data) simulation correct? > > Reply from a non-guru: > No. > > Antonio, on what basis did you make such an assumption, pray tell? > > Bert Gunter > Genentech Nonclinical Biostatistics > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- -Tony [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Vim-R-plugin (new version)
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 'dbSendQuery' or 'dbGetQuery' error from library 'RMySQL'
Dear R users, Basically, I desire to extract more than 1 column from a table in MySQL database. However, I get a pop-up error reading *"R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the incovenience."* when there are more than 1 field following "SELECT" phrase in the "dbSendQuery" function. Scripts below was used, *library(DBI) library(RMySQL)* * * *con <- dbConnect(MySQL(), user="XXX", password="XXX", dbname="XXX", host="XXX")* * * *foo <- dbSendQuery(con, "SELECT pol, claims FROM GI.marine ORDER BY pol" ) * *GI <- fetch(foo,n = -1)* When I specify only 1 field (i.e *foo <- dbSendQuery(con, "SELECT pol FROM GI.marine ORDER BY pol"* ), it gives the desired query result without any error. Your advise on resolving this issue would be highly appreciated. Steven [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 'persp' query
I'm pretty sure side =2 will put it on the left hand side. May only work for specific views. You would also want to assign an empty string to the persp zlab (although that's from memory and I don't have a session running to look up the argument.) -- David. On Oct 6, 2009, at 7:02 PM, Geoffrey William Heard wrote: Much thanks David and Peter I thought about mtext, but didn't try it, as was unsure what the appropriate 'side' value would be. Any thoughts? Cheers Geoff -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Wednesday, 7 October 2009 1:43 AM To: David Winsemius Cc: Geoffrey William Heard; r-help@r-project.org Subject: Re: [R] 'persp' query David Winsemius wrote: On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote: Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z-axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? ?mtext # and use the adj argument Good idea. This works well if your z-axis is fairly vertical on you plot. -Peter Ehlers David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 'persp' query
Much thanks David and Peter I thought about mtext, but didn't try it, as was unsure what the appropriate 'side' value would be. Any thoughts? Cheers Geoff -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Wednesday, 7 October 2009 1:43 AM To: David Winsemius Cc: Geoffrey William Heard; r-help@r-project.org Subject: Re: [R] 'persp' query David Winsemius wrote: > > On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote: > >> Hi All >> >> I'm creating some 3-D plots using the function 'persp', and have a >> query regarding the ability to make changes to the label of the z-axis. >> >> There are two things I would like to do. First, the default setting >> places the label a little close to the axis for my liking. Is there >> any way of moving the label? I've tried adjustments with 'mgp' in >> 'par', but without success. The second is to change the direction of >> the label. Currently it reads top to bottom, whereas I would like it >> to read bottom to top, as per a y-axis on a standard plot. Is there >> anyway of doing so? > > ?mtext # and use the adj argument > Good idea. This works well if your z-axis is fairly vertical on you plot. -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] MCMClogit confusion
Hello, running the code simulatedCase <- rbinom(100,1,0.5) simDf <- data.frame(CASE = simulatedCase) posterior_m0 <<- MCMClogit(CASE ~ 1, data = simDf, b0 = 0, B0 = 1) always results in an acceptance ratio of 0. If I do not specify b0 and B0, this does not occur. I do not understand the reasons for this behaviour - any explanation would be greatly appreciated! Thanks, Alexander -- View this message in context: http://www.nabble.com/MCMClogit-confusion-tp2554p2554.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] gnu ODBC driver for ORACLE in WinXP platform?
Hi R users and Dr. Uwe Ligges: I read on the ROracle pre-compiled binary README file that: "Although the package ROracle passes make check, it seems to be dangerous to distribute it: I do not have the software available this package depends on." Why it is dangerous to use ROracle for windows? What software does ROracle depends on in windows platform? Is there a GNU solution for an ODBC driver on windows XP platform for ORACLE for use it with RODBC? Thank you for your help. Kenneth __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unable to load 'doBy' package
Lauren Szathmary wrote: > > Hi all, > > I am trying to load the doBy package, and I am getting the following > error: > >> library(doBy) > Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : > there is no package called 'Hmisc' > Error: package/namespace load failed for 'doBy' > > This error message means that doBy depends on the Hmisc package, which is not installed. To ensure that a package is installed along with it's dependencies, install packages using the dependencies = T option: install.packages('doBy', dependencies = T ) Hope this helps! -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://www.nabble.com/Unable-to-load-%27doBy%27-package-tp25768101p25776865.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unable to load 'doBy' package
Thanks! I installed the Hmisc package and doBy loaded with no problem. On Wed, Oct 7, 2009 at 1:08 AM, joris meys wrote: > Hi Lauren, > > from the error message it looks like you have a problem with the > package "Hmisc". doBy is dependent on that one. Can you check whether > Hmisc is installed in your R version? For me, doBy loads without > problems. > > On Tue, Oct 6, 2009 at 12:18 PM, Lauren Szathmary > wrote: > > Hi all, > > > > I am trying to load the doBy package, and I am getting the following > error: > > > >> library(doBy) > > Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : > > there is no package called 'Hmisc' > > Error: package/namespace load failed for 'doBy' > > > > I tried updating R to the current version (2.9.2) and installing the most > > recent version of the doBy package (4.0.2), and the error remained the > > same. I also tried loading the package by going to my Package Manager > > window and clicking the box to load 'doBy', but that didn't work either. > My > > other packages (e.g., lattice, chron, etc.) are loading normally with no > > problems. > > > > If you have any suggestions for how I can get doBy to load, please let me > > know. > > > > Thanks very much, > > Lauren > > > >[[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Karl Ove Hufthammer Sent: Tuesday, October 06, 2009 1:56 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing Antonio Paredes skreiv: > I'm hoping to get a response from some of the R gurus in this list. Is my > assumption that R is not designed or build to deal with high levels (a > lots of simulated data) simulation correct? Reply from a non-guru: No. Antonio, on what basis did you make such an assumption, pray tell? Bert Gunter Genentech Nonclinical Biostatistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing
Antonio Paredes skreiv: > I'm hoping to get a response from some of the R gurus in this list. Is my > assumption that R is not designed or build to deal with high levels (a > lots of simulated data) simulation correct. For example, how to minimize > system time; do one have to call a lower level language like C or Fortran; > or just, like many of you have done, do a lots of programing in R and > eventually the tricks will be learned. Please supply example code of what you are trying to do, and what the difficulty is. As I mentioned, there should be no problem in generating all the random variables at once, as R generates the same values if you do it in chunks or all at once, but the latter method is much faster. (The example code should be runnable without us having to have access to any private or undefined dataset. The example code you mentioned in your first post contains many undefined variables, and it is not clear what it is trying to accomplish.) -- Karl Ove Hufthammer E-mail: k...@huftis.org Jabber: huf...@jabber.no __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot an arrow / add arrow to a line
How about arrows() ? On Tue, Oct 6, 2009 at 4:25 PM, Martin Batholdy wrote: > hi, > > is it possible to end a line plotted with lines() with an arrow? > Or are there any other functions to add an arrow to plot? > > > thanks! > -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot an arrow / add arrow to a line
hi, is it possible to end a line plotted with lines() with an arrow? Or are there any other functions to add an arrow to plot? thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
Folks: 1. No blame implied to anyone. However, as 64 bit Windows/R build is apparently not available except as a commercial product, may I suggest that henceforth it should not be discussed in this list and that any queries about it simply be directed to David Smith at Revolution. It just doesn't "feel" right to me to have these sorts of discussions here. I know that no commercialism was intended, but it still seems to me be oozing in. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David M Smith Sent: Tuesday, October 06, 2009 11:57 AM To: Jose Quesada Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] R on Linux, and R on Windows ,any difference in maturity+stability? I wanted to correct a couple of misconceptions raised in Jose's post below, which I'll take the liberty of addressing out of order. On Tue, Oct 6, 2009 at 7:34 AM, Jose Quesada wrote: > While revolution has > provided very nice packages to the community (e.g., foreach), the win-64 port as > of today is certainly the worst platform to do work on. Reasons: > (1) it's R 2.7.2 That's true, however REvolution R Enterprise based on R 2.9.2 is in beta testing right now. Creating a distribution of R under validated build processes adds a lot of extra process, testing, and overhead, and for this and other reasons our subscription "Enterprise" distributions don't track R version-to-version. Our free, community-based REvolution R distributions will track R much more closely beginning with 2.9.2. > (4) There's a proprietary repository, where most packages are outrageously > outdated. As a service to our users using REvolution R Enterprise we provide 64-bit Windows binary builds of as many R packages on CRAN as possible (see below). This is helpful to many of our users, because the tools to build binary packages for R on 64-bit Windows are not widely available. (Unfortunately, no free compiler is capable of building R for 64-bit Windows today. Believe me, we and many others have tried.) CRAN does not support Windows 64-bit binary packages, so we must provide a repository separate from CRAN (and our own CRAN mirror) for this purpose. But calling it a "proprietary repository" misleads -- all those packages are and remain free under the terms of their respective licenses (GPL and others). The packages are all compatible with R 2.7.2, which is currently the only 64-bit Windows version of R available. > (2) Many important packages will never be ported Some clarification is in order here. A number of packages on CRAN are not self-contained; some rely on third-party software or systems not part of R itself. For example, RGtk2 depends on the gtk+ software, which is only available in experimental form on the Windows 64-bit platform. This, obviously, has ramifications for the packages that they depend on. In some cases our support team has gone above and beyond for subscription customers to port third-party applications (for example, we ported the independent GraphViz software to 64-bit Windows to make RGraphViz from BioConductor work), but for obvious reasons this can only be done on a case-by-case basis. > (3) Some packages (particularly those depending on Rjava) would not work properly. See (2) above: as a contributed package, rJava is dependent on Windows' support for Java on the 64-bit platform. Some have noted that Microsoft's love for Java is less than legendary. > (5) Most help you find on R-help will not apply. Instead, you have 'paid' > support. Said support is slow, and close to useless in most cases. Jose is entitled to his opinion, but the live technical support provided by our team is a major feature of our subscription-based distributions - it is indeed what you pay for. We have many customers from commercial institutions large and small, on Windows 64-bit and other platforms, who have found great value in the responsiveness and expertise of our support services. As I've noted above, in many cases they go beyond the call of duty to deal with issues inherent to the Windows 64-bit operating system. Unfortunately, platform-specific issues are sometimes beyond our control, despite best efforts. > (6) Packages that rely on external tools (e.g., mysql) will take a lot of work > to get going. This is true of many software packages for 64-bit Windows including mysql. Unfortunately, the lack of good free compilers for the Windows 64-bit platform means that some open-source projects in particular are not readily available for 64-bit Windows (a situation we at REvolution Computing seek to remedy for R). > And of course, one have to pay for a yearly license, to have the privilege to > work under the above conditions. As Heinlein wrote, TANSTAAFL. The feedback we've had is that support for R is particularly beneficial on the 64-bit Windows platform, for exactly the reasons Jose raises above. > Note: this may change any time, sin
Re: [R] ggplot equivalent of par(xaxt)
Blindingly obvious!! Thanks for that. I can see it will help me find more than one option that I've been interested in. --- On Tue, 10/6/09, baptiste auguie wrote: > From: baptiste auguie > Subject: Re: [R] ggplot equivalent of par(xaxt) > To: "John Kane" > Cc: "R R-help" > Received: Tuesday, October 6, 2009, 3:07 PM > body(theme_grey) > > could help you find the name of a particular option (that's > what I did). > > baptiste > > 2009/10/6 John Kane : > > Lovely. I knew it was not that difficult, I had even > gotten as far as deciding it had to be an opts() command but > I had no idea of what it was. > > > > Thanks very much. > > > > > > > > --- On Tue, 10/6/09, baptiste auguie > wrote: > > > >> From: baptiste auguie > >> Subject: Re: [R] ggplot equivalent of par(xaxt) > >> To: "John Kane" > >> Cc: "R R-help" > >> Received: Tuesday, October 6, 2009, 2:57 PM > >> Hi, > >> > >> 2009/10/6 John Kane : > >> > How do I suppress the numbers on the x-axis? > >> > > >> > >> Try this, > >> > >> p + opts(axis.text.x = theme_blank()) > >> > >> HTH, > >> > >> baptiste > >> > >> > >> > >> > Thanks __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mixed effect multinomial regression
The bayesm package implements such models. Hth, Mike On Tue, 6 Oct 2009 12:41:18 -0700 James Martin wrote: > Hello list, > > I was trying to investigate the possible use of a mixed effect > multinomial logit model in R. Does anyone have suggestions on where > to find information on these models and the associated functions in R. > > Thanks in advance, > > jm > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Bifurcating Autoregression
Is there any R package that implements a bifurcating autoregression, aka the BAR(n) model? I've been reading the Huggins and Staudte paper, "Variance Components Models for Dependent Cell Populations", from the Journal of the American Statistical Association, 1994. Shawn Garbett Vanderbilt Cancer Biology 220 Pierce Ave, PRB 715AA Nashville, TN 37232 Office: 615.936.1975 Cell: 615.397.8737 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Mixed effect multinomial regression
Hello list, I was trying to investigate the possible use of a mixed effect multinomial logit model in R. Does anyone have suggestions on where to find information on these models and the associated functions in R. Thanks in advance, jm -- James A. Martin 850-445-9773 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting
A few days ago on the list I had wrestled with the aes() vs aes_string() issue, along with the same issue with facetting. The way I ended up handling the point you bring up, Baptiste, is perhaps rather inefficient but my data sets are not large. I allow the user to pass variables, then I use that info to construct extra data frame entries, which then are suitable for use by ggplot 2 since they are "known" in the data frame. Here's what the first part of the actual function looks like, you can see how I avoided aes_string and related problems with facet: compareCats <- function(data = NULL, res = NULL, fac1 = NULL, fac2 = NULL, fac1order = NULL, fac2order = NULL, fac1cols = NULL, method = c("sem", "iqr", "mad", "box", "points"), title = "Comparison of Categories", y.lab = "your text here", subtitle = "optional explanatory caption") { require(ggplot2) # restructure data so names will match, re-ordering too data$res <- data[, res] a <- match(fac1, names(data)) b <- match(fac2, names(data)) data$fac1 <- factor(data[[a]], levels = fac1order) data$fac2 <- factor(data[[b]], levels = fac2order) # now the plot p <- ggplot(data, aes(fac1, res, color = fac1)) + facet_grid(. ~ fac2) + xlab(NULL) + opts(title = title, axis.text.x = theme_text(colour = "black"), axis.ticks = theme_blank()) And then depending up on the method specified by the user, additional geoms are added and the plot created. This gets the job done, but if there are further suggestions, I'd love to learn other solutions. Bryan On 10/6/09 1:08 PM, "baptiste auguie" wrote: > Further to my previous reply, it occurred to me that ggplot2 would > only ever use data and colors in your calls to compareCats(): res = > res, fac1 = fac1, fac2 = fac2 have no effect whatsoever. > > If you want the user to be able to specify the variables used in the > ggplot2 call, you probably want to look at ?aes_string, as shown > below, > > compareCats <- function(data, fac1="fac1", fac2="fac2", res="res", > colors=c("red", "blue")) { > > require(ggplot2) > p <- ggplot(data, aes_string(x=fac1, y=res, color=fac1)) + > facet_grid(paste(". ~ ", fac2)) > jit <- position_jitter(width = 0.1) > p <- p + layer(geom = "jitter", position = jit) + > scale_colour_manual(values=colors) > print(p) > } > > test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), > fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) > > compareCats(data = test) > > rem <- sample(10, 1:ncol(test)) # randomly remove a few points here and there > last_plot() %+% test[-rem, ] # replot with new dataset > > HTH, > > baptiste > > > > > 2009/10/6 baptiste auguie : >> Hi, >> >> I may be missing an important design decision, but could you not have >> only a single data.frame as an argument of your function? From your >> example, it seems that the colour can be mapped to the fac1 variable >> of "data", >> >> compareCats <- function(data) { >> >> require(ggplot2) >> p <- ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) >> jit <- position_jitter(width = 0.1) >> p <- p + layer(geom = "jitter", position = jit) + >> scale_colour_manual(values=c("red", "blue")) >> print(p) >> } >> >> >> test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), >> fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) >> >> compareCats(data = test) >> >> rem <- runif(5, 1, 100) # randomly remove a few points here and there >> last_plot() %+% test[-rem,] # replot with new dataset >> >> >> HTH, >> >> baptiste >> >> >> >> 2009/10/6 Bryan Hanson : >>> Hello Again... I¹m making a faceted plot of a response on two categorical >>> variables using ggplot2 and having troubles with the coloring. Here is a >>> sample that produces the desired plot: >>> >>> compareCats <- function(data, res, fac1, fac2, colors) { >>> >>> require(ggplot2) >>> p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) >>> jit <- position_jitter(width = 0.1) >>> p <- p + layer(geom = "jitter", position = jit, color = colors) >>> print(p) >>> } >>> >>> test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), >>> fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) >>> >>> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >>> c("red", "blue")) >>> >>> Now, if I get away from idealized data where there are the same number of >>> data points per group (25 in this case), I run into problems. So, if you >>> do: >>> >>> rem <- runif(5, 1, 100) # randomly remove a few points here and there >>> test <- test[-rem,] >>> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >>> c("red", "blue")) >>> >>> R throws an error due to mismatch between the recycling of colors and the >>> actual number of data points: >>> >>> Error in `[<-.data.frame`(`*tmp*`, gp, value = list(colour = c("re
Re: [R] Text editors for Sweave (rnw) files
Emacs + ESS does too. Giovanni > Date: Tue, 06 Oct 2009 12:34:28 -0400 > From: Gabor Grothendieck > Sender: r-help-boun...@r-project.org > Cc: r-help@r-project.org > Precedence: list > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; > h=domainkey-signature:mime-version:received:in-reply-to:references > DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; > > vim/gvim does syntax highlighting of R, Sweave and latex. > > On Tue, Oct 6, 2009 at 12:30 PM, Gregory Gentlemen > wrote: > > Hi fellow R-users, > > > > Are there any text editors that recognize sweave (.rnw) files? I am running > > Windows Vista and in the past I used Tinn-R for R files but it > > (surprisingly) doesn't recognize rnw files and does not do any syntax > > highlighting for them. > > > > Thanks in advance, > > Greg > > > > > > > > __ > > Make your browsing faster, safer, and easier with the new Internet > > Explorer[[elided Yahoo spam]] > > com/ca/internetexplorer/ > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there a recent book on Q-Q plot and data visualization in general?
Hi, I checked the 3rd edition of this book. But I don't find Q-Q plot. Would you please take a look of the table of content below and let me know if the same section is available in the 3rd edition? http://www.amazon.com/Plane-Answers-Complex-Questions-Theory/dp/0387953612/ref=sr_1_1?ie=UTF8&s=books&qid=1254856526&sr=8-1#reader Regards, Peng On Tue, Oct 6, 2009 at 9:50 AM, Paul Hiemstra wrote: > Hi Peng Yu, > > Chapter 13 of the following book provides a good description of the > assumption done when using regression and other techniques. It also > discusses the QQplot. > > @BOOK{Christensen1996, > title = {Plane Answers to Complex Questions: The Theory of Linear Models}, > publisher = {Springer, New York}, > year = {1996}, > author = {Ronald Christensen}, > edition = {Second}, > note = {496p}, > } > > cheers, > Paul > > Peng Yu wrote: >> >> Hi, >> >> I want to look for some detailed explanation on the properties of Q-Q >> plot and how the properties are derived. >> >> In R, there is the following reference. >> Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S >> Language. Wadsworth & Brooks/Cole. >> >> Somebody also mentioned the following book chapter to me. >> Chambers et al., Graphical methods for Data Analysis, Ch.6. >> >> But both books are old. I'm wondering if there is any more recent >> (therefore, maybe better) books for Q-Q plot, and data visualization >> in general. >> >> Regards, >> Peng >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > -- > Drs. Paul Hiemstra > Department of Physical Geography > Faculty of Geosciences > University of Utrecht > Heidelberglaan 2 > P.O. Box 80.115 > 3508 TC Utrecht > Phone: +3130 274 3113 Mon-Tue > Phone: +3130 253 5773 Wed-Fri > http://intamap.geo.uu.nl/~paul > > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot equivalent of par(xaxt)
body(theme_grey) could help you find the name of a particular option (that's what I did). baptiste 2009/10/6 John Kane : > Lovely. I knew it was not that difficult, I had even gotten as far as > deciding it had to be an opts() command but I had no idea of what it was. > > Thanks very much. > > > > --- On Tue, 10/6/09, baptiste auguie wrote: > >> From: baptiste auguie >> Subject: Re: [R] ggplot equivalent of par(xaxt) >> To: "John Kane" >> Cc: "R R-help" >> Received: Tuesday, October 6, 2009, 2:57 PM >> Hi, >> >> 2009/10/6 John Kane : >> > How do I suppress the numbers on the x-axis? >> > >> >> Try this, >> >> p + opts(axis.text.x = theme_blank()) >> >> HTH, >> >> baptiste >> >> >> >> > Thanks >> > >> > >> > >> __ >> > [[elided Yahoo spam]] >> > >> > __ >> > R-help@r-project.org >> mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, >> reproducible code. >> > >> > > > __ > Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your > favourite sites. Download it now > http://ca.toolbar.yahoo.com. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot equivalent of par(xaxt)
Lovely. I knew it was not that difficult, I had even gotten as far as deciding it had to be an opts() command but I had no idea of what it was. Thanks very much. --- On Tue, 10/6/09, baptiste auguie wrote: > From: baptiste auguie > Subject: Re: [R] ggplot equivalent of par(xaxt) > To: "John Kane" > Cc: "R R-help" > Received: Tuesday, October 6, 2009, 2:57 PM > Hi, > > 2009/10/6 John Kane : > > How do I suppress the numbers on the x-axis? > > > > Try this, > > p + opts(axis.text.x = theme_blank()) > > HTH, > > baptiste > > > > > Thanks > > > > > > > __ > > [[elided Yahoo spam]] > > > > __ > > R-help@r-project.org > mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, > reproducible code. > > > __ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot equivalent of par(xaxt)
Hi, 2009/10/6 John Kane : > How do I suppress the numbers on the x-axis? > Try this, p + opts(axis.text.x = theme_blank()) HTH, baptiste > Thanks > > > __ > [[elided Yahoo spam]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
I wanted to correct a couple of misconceptions raised in Jose's post below, which I'll take the liberty of addressing out of order. On Tue, Oct 6, 2009 at 7:34 AM, Jose Quesada wrote: > While revolution has > provided very nice packages to the community (e.g., foreach), the win-64 port > as > of today is certainly the worst platform to do work on. Reasons: > (1) it's R 2.7.2 That's true, however REvolution R Enterprise based on R 2.9.2 is in beta testing right now. Creating a distribution of R under validated build processes adds a lot of extra process, testing, and overhead, and for this and other reasons our subscription "Enterprise" distributions don't track R version-to-version. Our free, community-based REvolution R distributions will track R much more closely beginning with 2.9.2. > (4) There's a proprietary repository, where most packages are outrageously > outdated. As a service to our users using REvolution R Enterprise we provide 64-bit Windows binary builds of as many R packages on CRAN as possible (see below). This is helpful to many of our users, because the tools to build binary packages for R on 64-bit Windows are not widely available. (Unfortunately, no free compiler is capable of building R for 64-bit Windows today. Believe me, we and many others have tried.) CRAN does not support Windows 64-bit binary packages, so we must provide a repository separate from CRAN (and our own CRAN mirror) for this purpose. But calling it a "proprietary repository" misleads -- all those packages are and remain free under the terms of their respective licenses (GPL and others). The packages are all compatible with R 2.7.2, which is currently the only 64-bit Windows version of R available. > (2) Many important packages will never be ported Some clarification is in order here. A number of packages on CRAN are not self-contained; some rely on third-party software or systems not part of R itself. For example, RGtk2 depends on the gtk+ software, which is only available in experimental form on the Windows 64-bit platform. This, obviously, has ramifications for the packages that they depend on. In some cases our support team has gone above and beyond for subscription customers to port third-party applications (for example, we ported the independent GraphViz software to 64-bit Windows to make RGraphViz from BioConductor work), but for obvious reasons this can only be done on a case-by-case basis. > (3) Some packages (particularly those depending on Rjava) would not work > properly. See (2) above: as a contributed package, rJava is dependent on Windows' support for Java on the 64-bit platform. Some have noted that Microsoft's love for Java is less than legendary. > (5) Most help you find on R-help will not apply. Instead, you have 'paid' > support. Said support is slow, and close to useless in most cases. Jose is entitled to his opinion, but the live technical support provided by our team is a major feature of our subscription-based distributions - it is indeed what you pay for. We have many customers from commercial institutions large and small, on Windows 64-bit and other platforms, who have found great value in the responsiveness and expertise of our support services. As I've noted above, in many cases they go beyond the call of duty to deal with issues inherent to the Windows 64-bit operating system. Unfortunately, platform-specific issues are sometimes beyond our control, despite best efforts. > (6) Packages that rely on external tools (e.g., mysql) will take a lot of work > to get going. This is true of many software packages for 64-bit Windows including mysql. Unfortunately, the lack of good free compilers for the Windows 64-bit platform means that some open-source projects in particular are not readily available for 64-bit Windows (a situation we at REvolution Computing seek to remedy for R). > And of course, one have to pay for a yearly license, to have the privilege to > work under the above conditions. As Heinlein wrote, TANSTAAFL. The feedback we've had is that support for R is particularly beneficial on the 64-bit Windows platform, for exactly the reasons Jose raises above. > Note: this may change any time, since they are working on a continuous build > that will keep the releases in sync with mainstream R. That's also true. We have been working on an automated build system for R and R packages. It will first be used for the Ubuntu release, but it's designed as a multiplatform system. It will allow us to keep our free community releases in sync with CRAN R, and keep packages we build up-to-date. In summary: I thank Jose for raising some important points to consider if you have the freedom to choose any platform and you need the additional memory capacity of a 64-bit version of R. But if you need to use 64-bit Windows and want to use R, the supported distribution REvolution R Enterprise has worked very well for many users. # David Smith -- David M Smith Director of Community, REvo
[R] ggplot equivalent of par(xaxt)
I am playing around learning ggplot and cannot see how to suppress the x or y axis values ( equivalent of xaxt in basic graphics) It must be obvious but I'm not seeing it. Problem = timedata <- structure(list(month = structure(c(5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun", "Mar", "May", "Nov", "Oct", "Sep"), class = "factor"), days = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L), temps = c(39.2896128958748, 24.0463892588954, 14.7144317681674, 26.4473300457299, 17.5444095397464, 17.0554503502032, 31.4467837626264, 26.8669765071813, 31.6581966018795, 33.6092903491756, 31.0445298273758, 40.3509587680154, 19.4642817074759, 25.4368212783209, 32.4769837888977, 20.0778425836075, 20.7275666901593, 7.67556461182032, 20.710769686952, 21.5516612954105, 26.7415743698656, 18.9571423249225, 29.4591207748791, 28.5211729296181, 17.4525627959805, 30.923234208759, 20.6069761349652, 32.5113389689697, 30.5485452291517, 36.108280749871, 33.1800210253601, 32.9708790994613, 36.6536488173013, 21.5872681514094, 17.3698466624875, 23.8735008677194, 21.7834805625618, 39.7441872059634, 19.2363318860703, 17.2332575158032, 16.5456489770264, 27.4925071988056, 15.416376720661, 47.0542371710754, 28.9163963545337, 16.5216554897757, 29.6730172832844, 24.2525944040588, 13.2414079242807, 15.9791856515821, 19.4387549406012, 33.9589173474519, 19.5190927150932, 26.3488819156667, 28.7998700507852, 23.9846608380048, 7.88582132117484, 18.6611269160678, 28.9459512288244, 29.7954832888135), duration = 1:60), .Names = c("month", "days", "temps", "duration"), row.names = c(NA, 60L), class = "data.frame") p <- ggplot(timedata, aes(duration, temps, colour=month)) + geom_line() + opts(legend.position = "none", title="Yearly temperatures") How do I suppress the numbers on the x-axis? Thanks __ [[elided Yahoo spam]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Export to Excel
I spotted quite nice blog post by learning r blog http://learnr.wordpress.com/2009/10/06/export-data-frames-to-multi-worksheet-excel-file/ very good summary how to export data from R to multiple Excel sheets. - Johannes __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to extract names from a vector
vec <- 1:700 names(vec) <- 700:1 names(vec)[grep("101", names(vec))] > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of kayj > Sent: Tuesday, October 06, 2009 12:49 PM > To: r-help@r-project.org > Subject: [R] How to extract names from a vector > > > Hi All, > > I have a character vector of length=700. The vector contains names and I > want to extract the names that contain the number 101. The number 101 > could > be anywhere within the name. > > what is the best way to do this? > > -- > View this message in context: http://www.nabble.com/How-to-extract-names- > from-a-vector-tp25773482p25773482.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 1:43 PM, David M Smith wrote: On Tue, Oct 6, 2009 at 10:30 AM, Duncan Murdoch wrote: When running a 32 bit program, 64 bit Windows hides most of itself outside the address space visible to the program, so almost all of the 4 Gb address space is available to the user. But no more: no matter how much RAM you install, it's not possible to address it using a 32 bit address. That's true when running a 32-bit version of R under 64-bit Windows. But on the 64-bit version of REvolution R Enterprise for Windows, you can create objects much larger than 4Gb, for example: memory.limit(2e+9) v<-double(1e+9) # 8GB vector sum(v) [1] 0 The same is true of 64-bit versions of R on other platforms, too. Yes, I was only talking about running 32 bit R. 64 bit R has another advantage on all platforms: since we're still using such a small fraction of the whole 64 bit address space, fragmentation isn't such a problem as it is with 32 bits. For those unfamiliar with the term: fragmentation happens when you allocate things at particular addresses, limiting the size of future allocations to the space available above or below or between those allocations. For the allocation David did, R needs a full 8Gb of memory at contiguous addresses. The hardware can remap physical or virtual memory to any 64 bit address it likes (within some fairly relaxed limits), so that's not a problem in 64 bit R. In 32 bit R, it means that a few small objects could easily cut your maximum allocation substantially. Pictorially, ---X--X--X--X--X-- those 5 X objects have limited future allocations to at most 6 dashes in size. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Robust ANOVA with variance heterogeneity
On Oct 6, 2009, at 1:51 PM, Kjetil Halvorsen wrote: On Sat, Oct 3, 2009 at 2:45 PM, David Winsemius > wrote: Do you have a citation for that statement? I cannot convince myself that it should be true. OK. that took some time, since I have no nonparametrics book with me, but it is a fairly standard assumption the friedman.test shares with wilcox.test and others. One online reference giving this is: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/friedman.html&http://www.google.cl/search ?q=assumptions+of+friedman +test&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en- US:unofficial&client=firefox-a specifically: "Friedman's test makes the following assumptions about the data in X: * All data come from populations having the same continuous distribution, apart from possibly different locations due to column and row effects. * All observations are mutually independent. " This is also easy to investigate by simulation in R: I did: A[, 1] <- rnorm(100, 0, 1) A[, 2] <- rnorm(100, 0, 5) A[, 3] <- rnorm(100, 0, 500) friedman.test(A) Friedman rank sum test data: A Friedman chi-squared = 2.96, df = 2, p-value = 0.2276 which surprised me! This test seems to be somewhat robust against variance heterogeneity ???, but that case is not included in the usual theory. I do not see that your citation implied that there would be a material impact (especially toward false positive results which I take to be the meaning of "not robust") from a violation of the equi-variance assumption, ... only that equivariance was the basis of the derivation of the statistical theory. The test might even be conservative for all we know until the question has been subjected to simulation studies. And then your simulation suggested not much of a problem, which does not seem surprising to me given that a rank transformation has been applied to the data. So I remain unconvinced. -- Regards; David. Kjetil After looking at the CRAN Task View, I would suggest the OP look at rlm(MASS) or lmrob(robustbase). -- David On Oct 2, 2009, at 11:05 AM, Kjetil Halvorsen wrote: On Fri, Oct 2, 2009 at 8:45 AM, David Winsemius > wrote: There are multiple routes to "robust" statistics, but the quick answer to this question is probably friedman.test I don't think friedman.test is robust to variance heterogeneity. It is only robust to non-normality. Kjetil I seem to remember a CRAN Task View on the area of Robust Statistics. -- David Winsemius On Oct 2, 2009, at 3:05 AM, Maike Luhmann wrote: Dear list members, I am looking for an alternative function for a two-way ANOVA in the case of variance heterogeneity. For one-way ANOVA, I found oneway.test(), but I didn't find anything alike for two-way ANOVA. Does anyone have a suggestion? Thank you! Maike Luhmann Freie Universität Berlin , David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to extract names from a vector
See ?grep On Tue, Oct 6, 2009 at 2:48 PM, kayj wrote: > > Hi All, > > I have a character vector of length=700. The vector contains names and I > want to extract the names that contain the number 101. The number 101 could > be anywhere within the name. > > what is the best way to do this? > > -- > View this message in context: > http://www.nabble.com/How-to-extract-names-from-a-vector-tp25773482p25773482.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to extract names from a vector
Hi All, I have a character vector of length=700. The vector contains names and I want to extract the names that contain the number 101. The number 101 could be anywhere within the name. what is the best way to do this? -- View this message in context: http://www.nabble.com/How-to-extract-names-from-a-vector-tp25773482p25773482.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to output profile plots for groups using lattice package
Dear R users, I am trying to have an xyplot of a data set which has the following variables: case (n=10,20,30) parameter (parm=a,b) group (grp=g1,g2) y (y values) x (x=2,4,8) My plot should be parameter by case such that I have 2 rows (each row= each parameter) and 3 columns (each column=each case). My R-code is as follows but I am not able to get what I want to: tp1.sim <- xyplot(y~ x | case + parm , group=group, data = data, lty = 1:4 , pch = 1:4) print(tp1.sim) How can I have two lines (for g1 and g2) in each plot (each box)? How do I label the x-axis with only values 2, 4, 8? How do I label each column with the corresponding case number? My hypothetical data set is as follows: parm x case y group a 2 10 0.03 g1 b 2 10 0.02 g1 a 4 10 0.03 g1 b 4 10 0.02 g1 a 8 10 0.03 g1 b 8 10 0.02 g1 a 2 20 0.03 g1 b 2 20 0.02 g1 a 4 20 0.03 g1 b 4 20 0.02 g1 a 8 20 0.03 g1 b 8 20 0.02 g1 a 2 30 0.03 g1 b 2 30 0.02 g1 a 4 30 0.03 g1 b 4 30 0.02 g1 a 8 30 0.03 g1 b 8 30 0.02 g1 a 2 10 0.13 g2 b 2 10 0.12 g2 a 4 10 0.13 g2 b 4 10 0.12 g2 a 8 10 0.13 g2 b 8 10 0.12 g2 a 2 20 0.13 g2 b 2 20 0.12 g2 a 4 20 0.13 g2 b 4 20 0.12 g2 a 8 20 0.13 g2 b 8 20 0.12 g2 a 2 30 0.13 g2 b 2 30 0.12 g2 a 4 30 0.13 g2 b 4 30 0.12 g2 a 8 30 0.13 g2 b 8 30 0.12 g2 Many thanks in advance for your response. George [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Robust ANOVA with variance heterogeneity
Hola! see below. On Sat, Oct 3, 2009 at 2:45 PM, David Winsemius wrote: > Do you have a citation for that statement? I cannot convince myself that it > should be true. OK. that took some time, since I have no nonparametrics book with me, but it is a fairly standard assumption the friedman.test shares with wilcox.test and others. One online reference giving this is: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/friedman.html&http://www.google.cl/search?q=assumptions+of+friedman+test&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a specifically: "Friedman's test makes the following assumptions about the data in X: * All data come from populations having the same continuous distribution, apart from possibly different locations due to column and row effects. * All observations are mutually independent. " This is also easy to investigate by simulation in R: I did: > A[, 1] <- rnorm(100, 0, 1) > A[, 2] <- rnorm(100, 0, 5) > A[, 3] <- rnorm(100, 0, 500) > friedman.test(A) Friedman rank sum test data: A Friedman chi-squared = 2.96, df = 2, p-value = 0.2276 which surprised me! This test seems to be somewhat robust against variance heterogeneity ???, but that case is not included in the usual theory. Kjetil > > After looking at the CRAN Task View, I would suggest the OP look at > rlm(MASS) or lmrob(robustbase). > > -- > David > > On Oct 2, 2009, at 11:05 AM, Kjetil Halvorsen wrote: > >> On Fri, Oct 2, 2009 at 8:45 AM, David Winsemius >> wrote: >>> >>> There are multiple routes to "robust" statistics, but the quick answer to >>> this question is probably friedman.test >> >> I don't think friedman.test is robust to variance heterogeneity. It is >> only robust to >> non-normality. >> >> Kjetil >> >> >> >>> >>> I seem to remember a CRAN Task View on the area of Robust Statistics. >>> >>> -- >>> David Winsemius >>> >>> >>> On Oct 2, 2009, at 3:05 AM, Maike Luhmann wrote: >>> Dear list members, I am looking for an alternative function for a two-way ANOVA in the case of variance heterogeneity. For one-way ANOVA, I found oneway.test(), but I didn't find anything alike for two-way ANOVA. Does anyone have a suggestion? Thank you! Maike Luhmann Freie Universität Berlin >>> >>> __ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
On Tue, Oct 6, 2009 at 10:30 AM, Duncan Murdoch wrote: > When running a 32 bit program, 64 bit Windows hides most of itself outside > the address space visible to the program, so almost all of the 4 Gb address > space is available to the user. But no more: no matter how much RAM you > install, it's not possible to address it using a 32 bit address. That's true when running a 32-bit version of R under 64-bit Windows. But on the 64-bit version of REvolution R Enterprise for Windows, you can create objects much larger than 4Gb, for example: > memory.limit(2e+9) > v<-double(1e+9) # 8GB vector > sum(v) [1] 0 The same is true of 64-bit versions of R on other platforms, too. # David Smith -- David M Smith Director of Community, REvolution Computing www.revolution-computing.com Tel: +1 (206) 577-4778 x3203 (San Francisco, USA) Check out our upcoming events schedule at www.revolution-computing.com/events __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 1:17 PM, Kjetil Halvorsen wrote: On Tue, Oct 6, 2009 at 11:23 AM, Duncan Murdoch wrote: On 10/6/2009 10:34 AM, Jose Quesada wrote: Robert Wilkins gmail.com> writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). By default, 32 bit Windows only gives 2 Gb for all the user processes to share, and saves the rest of memory for itself. You can change this (see the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, _and a bit under 4 Gb in 64 bit Windows. That sounds incredible. ¿Why so? When running a 32 bit program, 64 bit Windows hides most of itself outside the address space visible to the program, so almost all of the 4 Gb address space is available to the user. But no more: no matter how much RAM you install, it's not possible to address it using a 32 bit address. Duncan Murdoch Kjetil Duncan Murdoch While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Way of handling empty value when reading in CSV
Does this do what you want: )> x <- read.csv(textConnection("home,sqr_footage,cost,color,exterior + 1,1500,15,,Siding + 2,2000,20,Red,Brick + 3,,30,Grey,Brick + 4,3500,35,Blue, + 5,4000,45,Red,Brick"), na.strings='') > closeAllConnections() > > x home sqr_footage cost color exterior 111500 15 Siding 222000 20 RedBrick 33 NA 30 GreyBrick 443500 35 Blue 554000 45 RedBrick > On Tue, Oct 6, 2009 at 1:12 PM, Jason Rupert wrote: > Well, I guess I posted a poor example. > > This example is a little closer: > home,sqr_footage,cost,color,exterior > 1,1500,15,,Siding > 2,2000,20,Red,Brick > 3,,30,Grey,Brick > 4,3500,35,Blue, > 5,4000,45,Red,Brick > > This one actually shows the presence of the null fields that are loaded. > > Sorry again for the poor 1st example. > > Thank you again for your time and insight. > > > > --- On Tue, 10/6/09, Erik Iverson wrote: > >> From: Erik Iverson >> Subject: RE: [R] Way of handling empty value when reading in CSV >> To: "Jason Rupert" , "R-help@r-project.org" >> >> Date: Tuesday, October 6, 2009, 11:42 AM >> I saved your data as test.csv, and >> >> > read.csv("~/test.csv", header = TRUE) >> home sqr_footage cost >> 1 1 1500 15 >> 2 2 2000 20 >> 3 3 NA >> 30 >> 4 4 3500 35 >> 5 5 4000 45 >> >> I am using R 2.8.1, old I know... but maybe something else >> is going on? Do you really get a blank when you read >> in your sample data? >> >> Erik >> >> > -Original Message- >> > From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] >> > On Behalf Of Jason Rupert >> > Sent: Tuesday, October 06, 2009 11:39 AM >> > To: R-help@r-project.org >> > Subject: [R] Way of handling empty value when reading >> in CSV >> > >> > I believe I may be overlooking something simple in >> order address this, but >> > I have searched RSeek.org and using "?", but cannot >> seem to find anything >> > discussing this one. >> > >> > >> > I am using read.csv to read in a csv file. >> Evidently in places there is >> > nothing between the commas, so that when the data is >> read in the >> > data.frame produced has values that are empty. >> > >> > >> > Is there a way to fix this when reading the data via >> "read.csv"? I looked >> > at all the options mentioned in ?read.csv, but did not >> see anything to >> > address this case, e.g. >> > >> > >> > home,sqr_footage,cost >> > 1,1500,15 >> > 2,2000,20 >> > 3,,30 >> > 4,3500,35 >> > 5,4000,45 >> > >> > >> > I would like for the empty cells to have a value of >> "NA" when they are >> > read in. >> > >> > >> > Thank you for any feedback and insights. >> > >> > __ >> > R-help@r-project.org >> mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide http://www.R-project.org/posting- >> > guide.html >> > and provide commented, minimal, self-contained, >> reproducible code. >> > > > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting
Hi Baptiste: Thanks for the suggestion. It will work perfectly. I would have never considered assigning a color to a variable that contained no colors at all! I guess this is part of the aesthetic concept, which I haven't had time to reflect on much. Then later, specify a manual color scale which then maps back onto the aesthetic. Clever. As I stated, I'm just learning ggplot2, and I'm finding the language and concepts a bit different (I'm not familiar with the "grammar of graphics", nor am I a computer scientist). But, I have to say the code I am working up replaces a much much longer code in base graphics, so I am really liking the thought put into ggplot2 and the leanness of it - Thanks Hadley! Thanks again, Bryan On 10/6/09 12:36 PM, "baptiste auguie" wrote: > Hi, > > I may be missing an important design decision, but could you not have > only a single data.frame as an argument of your function? From your > example, it seems that the colour can be mapped to the fac1 variable > of "data", > > compareCats <- function(data) { > >require(ggplot2) >p <- ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) >jit <- position_jitter(width = 0.1) >p <- p + layer(geom = "jitter", position = jit) + > scale_colour_manual(values=c("red", "blue")) >print(p) >} > > > test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), >fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) > > compareCats(data = test) > > rem <- runif(5, 1, 100) # randomly remove a few points here and there > last_plot() %+% test[-rem,] # replot with new dataset > > > HTH, > > baptiste > > > > 2009/10/6 Bryan Hanson : >> Hello Again... I¹m making a faceted plot of a response on two categorical >> variables using ggplot2 and having troubles with the coloring. Here is a >> sample that produces the desired plot: >> >> compareCats <- function(data, res, fac1, fac2, colors) { >> >> require(ggplot2) >> p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) >> jit <- position_jitter(width = 0.1) >> p <- p + layer(geom = "jitter", position = jit, color = colors) >> print(p) >> } >> >> test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), >> fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) >> >> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >> c("red", "blue")) >> >> Now, if I get away from idealized data where there are the same number of >> data points per group (25 in this case), I run into problems. So, if you >> do: >> >> rem <- runif(5, 1, 100) # randomly remove a few points here and there >> test <- test[-rem,] >> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >> c("red", "blue")) >> >> R throws an error due to mismatch between the recycling of colors and the >> actual number of data points: >> >> Error in `[<-.data.frame`(`*tmp*`, gp, value = list(colour = c("red", : >> replacement element 1 has 2 rows, need 47 >> >> I'm new to ggplot2, but have been through the book and the web site enough >> to know that my problem is "mapping the varible to the aesthetic"; I also >> know I can either "map" or "set" the colors. >> >> The question, finally: is there an simple/elegant way to map a list of two >> colors corresponding to A and B onto any random sample size of A and B with >> faceting? If not, and I must "set" the colors: Do I compute the length of >> all possible combos of A, B with lrg, sm, and then create one long vector of >> colors for the entire plot? I tried something like this, and was not >> successful, but perhaps could be with more work. >> >> All advice appreciated, Bryan (session info below) >> >> * >> Bryan Hanson >> Professor of Chemistry & Biochemistry >> DePauw University, Greencastle IN USA >> >>> sessionInfo() >> R version 2.9.2 (2009-08-24) >> i386-apple-darwin8.11.1 >> >> locale: >> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] grid datasets tools utils stats graphics grDevices >> methods >> [9] base >> >> other attached packages: >> [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_22.0 >> [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 >> [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 >> robustbase_0.4-5 >> [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 >> [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 >> [21] e1071_1.5-19 class_7.2-48 >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
On Tue, Oct 6, 2009 at 11:23 AM, Duncan Murdoch wrote: > On 10/6/2009 10:34 AM, Jose Quesada wrote: >> >> Robert Wilkins gmail.com> writes: >> >>> >>> Will R have more glitches on one operating system as opposed to >>> another, or is it pretty much the same? >>> >>> robert >>> >>> >> >> One important difference is that, if you are unsing large datasets and >> need >> memory, then windows is by far the worst. CRAN R is 32 bit and can only >> address 1.5 Gb of memory (or something similar; I >> don't really understand why). > > By default, 32 bit Windows only gives 2 Gb for all the user processes to > share, and saves the rest of memory for itself. You can change this (see > the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, > _and a bit under 4 Gb in 64 bit Windows. > That sounds incredible. ¿Why so? Kjetil > Duncan Murdoch > >> >> While there's a 64-bit version of R for windows (revolution-computing.com) >> I >> would advise against using it, for several reasons. While revolution has >> provided very nice packages to the community (e.g., foreach), the win-64 >> port as >> of today is certainly the worst platform to do work on. Reasons: >> (1) it's R 2.7.2 >> (2) Many important packages will never be ported >> (3) Some packages (particularly those depending on Rjava) would not work >> properly >> (4) There's a proprietary repository, where most packages are outrageously >> outdated. (5) Most help you find on R-help will not apply. Instead, you >> have 'paid' >> support. Said support is slow, and close to useless in most cases. >> (6) Packages that rely on external tools (e.g., mysql) will take a lot of >> work >> to get going. >> And of course, one have to pay for a yearly license, to have the privilege >> to >> work under the above conditions. >> >> If you need 64-bit right now, my advice is to switch to basically any >> other >> platform. >> >> Note: this may change any time, since they are working on a continuous >> build >> that will keep the releases in sync with mainstream R. >> >> Jose Quesada, PhD. >> Max Planck Institute, Human Development, Berlin >> http://www.josequesada.name/ >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Way of handling empty value when reading in CSV
Well, I guess I posted a poor example. This example is a little closer: home,sqr_footage,cost,color,exterior 1,1500,15,,Siding 2,2000,20,Red,Brick 3,,30,Grey,Brick 4,3500,35,Blue, 5,4000,45,Red,Brick This one actually shows the presence of the null fields that are loaded. Sorry again for the poor 1st example. Thank you again for your time and insight. --- On Tue, 10/6/09, Erik Iverson wrote: > From: Erik Iverson > Subject: RE: [R] Way of handling empty value when reading in CSV > To: "Jason Rupert" , "R-help@r-project.org" > > Date: Tuesday, October 6, 2009, 11:42 AM > I saved your data as test.csv, and > > > read.csv("~/test.csv", header = TRUE) > home sqr_footage cost > 1 1 1500 15 > 2 2 2000 20 > 3 3 NA > 30 > 4 4 3500 35 > 5 5 4000 45 > > I am using R 2.8.1, old I know... but maybe something else > is going on? Do you really get a blank when you read > in your sample data? > > Erik > > > -Original Message- > > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] > > On Behalf Of Jason Rupert > > Sent: Tuesday, October 06, 2009 11:39 AM > > To: R-help@r-project.org > > Subject: [R] Way of handling empty value when reading > in CSV > > > > I believe I may be overlooking something simple in > order address this, but > > I have searched RSeek.org and using "?", but cannot > seem to find anything > > discussing this one. > > > > > > I am using read.csv to read in a csv file. > Evidently in places there is > > nothing between the commas, so that when the data is > read in the > > data.frame produced has values that are empty. > > > > > > Is there a way to fix this when reading the data via > "read.csv"? I looked > > at all the options mentioned in ?read.csv, but did not > see anything to > > address this case, e.g. > > > > > > home,sqr_footage,cost > > 1,1500,15 > > 2,2000,20 > > 3,,30 > > 4,3500,35 > > 5,4000,45 > > > > > > I would like for the empty cells to have a value of > "NA" when they are > > read in. > > > > > > Thank you for any feedback and insights. > > > > __ > > R-help@r-project.org > mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > > guide.html > > and provide commented, minimal, self-contained, > reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Spatial Autocorrelation
In addition to the taskview (below), you might consider using the "sos" package, something like the following: sa <- ???'spatial autocorrelation' # 58 matches sc <- ???'spatial correlation' # 181 matches s. <- sa|sc # union of the to 'findFn' objects summary(s.) # 224 links in 57 packages installPackages(s.) # install packages with at least 5 >= sqrt(max(count)) matches writeFindFn2xls(s.) # write an Excel file with 3 sheets: PackageSum2, findFn, call This tells you that 22 help pages in "spdep" matched the search term, plus 18 pages in each of nlme, ncf, and spatstat, as well as 17 in ramps and 15 in geoR. The "PackageSum2" sheet also provides other information to help you decide which package to consider first. Beyond this, you may like to uses these functions with other search terms; see vignette('sos') for more information. Hope this helps. Spencer Disclaimer: I'm the lead author of "sos". Corey Sparks wrote: Hi Paulo, if your data are distance matrices, you might consider doing a Mantel test, look at the mantel() function in package vegan. While this is not technically measuring spatial autocorrelation, it will test for correlation between the attribute distances and the geographic distances. Also, if you can coax your data back into a point shapefile (for example), you can use the tools in the spdep package which will measure actual spatial autocorrelation (such as Moran's I and Geary's C). Best, Corey silcha wrote: Hi Paulo, you may want to take a look at http://cran.r-project.org/web/views/Spatial.html there, you can find all "spatial" packages that can be useful for your question. There is also a a mailing list R-sig-geo that where you can ask all those kind of question. Hope that this helps. Cheers Anna Anna Freni Sterrantino Ph.D Student Department of Statistics University of Bologna, Italy via Belle Arti 41, 40124 BO. Da: P.Branco A: r-help@r-project.org Inviato: Martedì 6 ottobre 2009, 13:28:36 Oggetto: [R] Spatial Autocorrelation Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ spazio gratuito per i tuoi file e i messaggi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Spencer Graves, PE, PhD President and Chief Operating Officer Structure Inspection and Monitoring, Inc. 751 Emerson Ct. San José, CA 95126 ph: 408-655-4567 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting
Further to my previous reply, it occurred to me that ggplot2 would only ever use data and colors in your calls to compareCats(): res = res, fac1 = fac1, fac2 = fac2 have no effect whatsoever. If you want the user to be able to specify the variables used in the ggplot2 call, you probably want to look at ?aes_string, as shown below, compareCats <- function(data, fac1="fac1", fac2="fac2", res="res", colors=c("red", "blue")) { require(ggplot2) p <- ggplot(data, aes_string(x=fac1, y=res, color=fac1)) + facet_grid(paste(". ~ ", fac2)) jit <- position_jitter(width = 0.1) p <- p + layer(geom = "jitter", position = jit) + scale_colour_manual(values=colors) print(p) } test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) compareCats(data = test) rem <- sample(10, 1:ncol(test)) # randomly remove a few points here and there last_plot() %+% test[-rem, ] # replot with new dataset HTH, baptiste 2009/10/6 baptiste auguie : > Hi, > > I may be missing an important design decision, but could you not have > only a single data.frame as an argument of your function? From your > example, it seems that the colour can be mapped to the fac1 variable > of "data", > > compareCats <- function(data) { > > require(ggplot2) > p <- ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) > jit <- position_jitter(width = 0.1) > p <- p + layer(geom = "jitter", position = jit) + > scale_colour_manual(values=c("red", "blue")) > print(p) > } > > > test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), > fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) > > compareCats(data = test) > > rem <- runif(5, 1, 100) # randomly remove a few points here and there > last_plot() %+% test[-rem,] # replot with new dataset > > > HTH, > > baptiste > > > > 2009/10/6 Bryan Hanson : >> Hello Again... I¹m making a faceted plot of a response on two categorical >> variables using ggplot2 and having troubles with the coloring. Here is a >> sample that produces the desired plot: >> >> compareCats <- function(data, res, fac1, fac2, colors) { >> >> require(ggplot2) >> p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) >> jit <- position_jitter(width = 0.1) >> p <- p + layer(geom = "jitter", position = jit, color = colors) >> print(p) >> } >> >> test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), >> fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) >> >> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >> c("red", "blue")) >> >> Now, if I get away from idealized data where there are the same number of >> data points per group (25 in this case), I run into problems. So, if you >> do: >> >> rem <- runif(5, 1, 100) # randomly remove a few points here and there >> test <- test[-rem,] >> compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = >> c("red", "blue")) >> >> R throws an error due to mismatch between the recycling of colors and the >> actual number of data points: >> >> Error in `[<-.data.frame`(`*tmp*`, gp, value = list(colour = c("red", : >> replacement element 1 has 2 rows, need 47 >> >> I'm new to ggplot2, but have been through the book and the web site enough >> to know that my problem is "mapping the varible to the aesthetic"; I also >> know I can either "map" or "set" the colors. >> >> The question, finally: is there an simple/elegant way to map a list of two >> colors corresponding to A and B onto any random sample size of A and B with >> faceting? If not, and I must "set" the colors: Do I compute the length of >> all possible combos of A, B with lrg, sm, and then create one long vector of >> colors for the entire plot? I tried something like this, and was not >> successful, but perhaps could be with more work. >> >> All advice appreciated, Bryan (session info below) >> >> * >> Bryan Hanson >> Professor of Chemistry & Biochemistry >> DePauw University, Greencastle IN USA >> >>> sessionInfo() >> R version 2.9.2 (2009-08-24) >> i386-apple-darwin8.11.1 >> >> locale: >> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] grid datasets tools utils stats graphics grDevices >> methods >> [9] base >> >> other attached packages: >> [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_2.2.0 >> [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 >> [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 >> robustbase_0.4-5 >> [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 >> [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 >> [21] e1071_1.5-19 class_7.2-48 >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.
Re: [R] mle from stats4
Stephen Collins-6 wrote: > > I am using mle as a wrapper from optim( ). How would I extract the > convergence code, to know that optim( ) converged properly? > > library(stats4) example(mle) slotNames(fit1) f...@details f...@details$convergence -- View this message in context: http://www.nabble.com/mle-from-stats4-tp25772337p25772668.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mle from stats4
Stephen Collins wrote: I am using mle as a wrapper from optim( ). How would I extract the convergence code, to know that optim( ) converged properly? The return value from optim is contained in the details slot, so > f...@details$convergence [1] 0 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Text editors for Sweave (rnw) files
Hi, On Oct 6, 2009, at 12:30 PM, Gregory Gentlemen wrote: Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. I don't run windows, but rumor has it that the e-texteditor is supposed to support TextMate bundles. So, since TextMate has bundles to support *.R, *.Rnw, *.Rd files, I would imagine the e editor could work, too: Editor: http://www.e-texteditor.com/ Getting more bundles: http://e-texteditor.com/wiki/index.php/Bundles#How_To_Get_More_Bundles You'll see several R bundles here (for TextMate, which should theoretically work for you) http://svn.textmate.org/trunk/Bundles/ I suspect this would be the one you want: http://svn.textmate.org/trunk/Bundles/R.tmbundle/ Hope that helps, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: Long for Loop- calling C from R - Parallel Computing
It would help to understand the problem you are trying to solve and the constraints that you have to live under. I routinely process files with millions of rows of data, do a lot of processing and create graphics/reports from them in what I think is reasonable time (a couple of minutes at most for the complex stuff) all within R without having to write C/FORTRAN. I am not sure what assumptions you are currently operating under, but it would be good to state them so that we know how to reply to the question that you are asking. There are performance tips that can be provided if we knew what you were trying to do. On Tue, Oct 6, 2009 at 10:10 AM, Antonio Paredes wrote: > -- Forwarded message -- > From: Antonio Paredes > Date: Tue, Oct 6, 2009 at 9:41 AM > Subject: Re: [R] Long for Loop- calling C from R - Parallel Computing > To: Karl Ove Hufthammer > > > Hello again, > > I'm hoping to get a response from some of the R gurus in this list. Is my > assumption that R is not designed or build to deal with high levels (a lots > of simulated data) simulation correct. For example, how to minimize system > time; do one have to call a lower level language like C or Fortran; or just, > like many of you have done, do a lots of programing in R and eventually the > tricks will be learned. > > Thanks > > On Mon, Oct 5, 2009 at 8:35 AM, Antonio Paredes > wrote: > >> In my case it does, because I need to preserved a "high level" of >> independence (lack of correlation) among the different groups of 60. Also, >> when I say final result I mean computation of standard errors and that >> source of stuff; sorry about the lack clarity in my statement. >> >> >> On Mon, Oct 5, 2009 at 9:48 AM, Karl Ove Hufthammer wrote: >> >>> In article <6f6f0fd60910050629p28c99209jcd7836353fd2d754 >>> @mail.gmail.com>, antonioparede...@gmail.com says... >>> > I'm running the following for loop to generate random variables in >>> chunks of >>> > 60 at a time (l), here h is of order in millions (could be 5 to 6 >>> millions), >>> > note that generating all the variables at once could have an impact on >>> the >>> > final results >>> >>> No, it will not. See this example code for an illustration: >>> >>> set.seed(1) >>> rnorm(3) >>> rnorm(3) >>> set.seed(1) >>> rnorm(6) >>> >>> So if you generate the six numbers three at a time or all at once gives >>> exactly the same result. >>> >>> So my suggestion is to generate all the numbers at once. That takes next >>> to no time. Or, if it takes too much memory, generate for example a >>> million at once, and repeat a few times. >>> >>> -- >>> Karl Ove Hufthammer >>> >>> __ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> >> >> -- >> -Tony >> > > > > -- > -Tony > > > > -- > -Tony > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Way of handling empty value when reading in CSV
I saved your data as test.csv, and > read.csv("~/test.csv", header = TRUE) home sqr_footage cost 111500 15 222000 20 33 NA 30 443500 35 554000 45 I am using R 2.8.1, old I know... but maybe something else is going on? Do you really get a blank when you read in your sample data? Erik > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Jason Rupert > Sent: Tuesday, October 06, 2009 11:39 AM > To: R-help@r-project.org > Subject: [R] Way of handling empty value when reading in CSV > > I believe I may be overlooking something simple in order address this, but > I have searched RSeek.org and using "?", but cannot seem to find anything > discussing this one. > > > I am using read.csv to read in a csv file. Evidently in places there is > nothing between the commas, so that when the data is read in the > data.frame produced has values that are empty. > > > Is there a way to fix this when reading the data via "read.csv"? I looked > at all the options mentioned in ?read.csv, but did not see anything to > address this case, e.g. > > > home,sqr_footage,cost > 1,1500,15 > 2,2000,20 > 3,,30 > 4,3500,35 > 5,4000,45 > > > I would like for the empty cells to have a value of "NA" when they are > read in. > > > Thank you for any feedback and insights. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Letter-based representation of pairwise comparisons
Hello: That's because the required input should be a symmetric matrix with all the comparisons, e.g., it should have the self-comparisons diagonal. In an hypotetical case with two treatments, the pairwise-comparison test output is something like that: A B B 0.80- but multcompView requires an input like that one: A B A 1 - B 0.80 1 That means you should add a new row and column for your missing treatments and, then, a diagonal of "1"s meaning that each treatment compared with itself will result in a p-value of 1 (maximal identity). Then, the new matrix could be piped succesfully. Regards, Retama goz wrote: > > hello, > > i try to use the multcomp letters, but i have problems with my results : > > here is my pvalue matrix (from a pairwise.t.test) : > > pair=pairwise.t.test(...) > pair$p.value > > 0 BBxS > B0.01727- - > BxS 0.000130.00226 - > S0.875550.02610 0.00027 > > > i was thiking to have something like that : > 0 B S BxS > a b a c > > but function return : > >> multcompLetters(pair$p.value) > B BxS S > "a" "b" "a" > > > first question : why the 0 traitement doesn't appears in result ? > second : why the results differs than what i expected ? > > many thanks. > > -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25769894.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] linear model with coefficient constraints
I would like to perform a regression like the one below: lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data) However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and c1+c2+c3 = C, where A, B, and C are positive constants. So there are two extra degrees of freedom, and R handles this by producing NA for two of the coefficients. Instead, I would prefer to remove the degrees of freedom by forcing constraints on the coefficients produced by the model. Specifically, I want coeff(b1) + coeff(b2) + coeff(b3) = coeff(c1) + coeff(c2) + coeff(c3) = 0. I could accomplish this by writing code to suitably shift the coefficients after performing the basic regression above, but I'm hoping there's a better way. Is there? thanks, Rnewb -- View this message in context: http://www.nabble.com/linear-model-with-coefficient-constraints-tp25769020p25769020.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Text editors for Sweave (rnw) files
On 10/6/09, Gregory Gentlemen wrote: > Are there any text editors that recognize sweave (.rnw) files? I am running > Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) > doesn't recognize rnw files and does not do any syntax highlighting for them. > Slightly off-topic reply. You can compose Sweave documents using LyX, in which case you would not need syntax highlighting. Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Date-Time-Stamp input method for user-specific formats
Another solution, as a fix to my original algorithm, was found by a colleague (Matthew Roberts). While he claims not too much for its elegance, it does seem to work. This fix is based on the use of the 'pmax' function. This function is a variant of the 'max' (maximum) function to return a vector of results corresponding to vectors of inputs. Example: max(1:3,4:8) == 8 but pmax(1:3,4:6) == 4 5 6. Thanks to this, it provides appropriate results for all rows of the data. In the code, there are two possible datetimestamp interpretations, midnight and non midnight, each implemented by a 'strptime' call. When a midnight datetimestamp is encountered, only the midnight conversion will return a proper (non NA) value. Thanks to the "na.rm=TRUE" option, the NA result is removed so 'pmax' returns just the proper value. For a non midnight datetimestamp, both midnight and non midnight conversions return proper values, but only the non midnight conversion will give a result greater than midnight, and it is this that is returned by the 'pmax'. The code is as follows: spot_frequency_readin <- function(file,nrows=-1) { # create temp class setClass("t_class2_", representation("character")) setAs("character", "t_class2_", function(from) { as.POSIXct(pmax(strptime(from, format="%d/%m/%Y"), strptime(from, format="%d/%m/%Y %H:%M:%S"), na.rm=TRUE), tz="GMT") } ) #(for format symbols, see "R Reference Card") # read the file (TSV) file <- read.delim(file, header=TRUE, comment.char = "", nrows=nrows, as.is=FALSE, col.names=c("DATETIME", "FREQ"), colClasses=c("t_class2_", "numeric") ) # remove it now that we are done with it removeClass("t_class2_") return(file) } The result: > spot DATETIME FREQ 1 2009-09-01 00:00:00 50.036 2 2009-09-01 00:00:01 50.035 3 2009-09-01 00:00:02 50.035 4 2009-09-01 00:00:03 50.033 Confirm the nature of the result: > str(spot) 'data.frame': 4 obs. of 2 variables: $ DATETIME: POSIXct, format: "2009-09-01 00:00:00" "2009-09-01 00:00:01" "2009-09-01 00:00:02" "2009-09-01 00:00:03" $ FREQ: num 50 50 50 50 (Note: 'str' means "Compactly display the internal structure of an R object". I can claim from experience that his and 'ls.str' are things that the novice R user can benefit hugely from knowing about) -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25770983.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] mle from stats4
I am using mle as a wrapper from optim( ). How would I extract the convergence code, to know that optim( ) converged properly? Thanks, Stephen Collins, MPP | Analyst Global Strategy | Aon Benfield [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Way of handling empty value when reading in CSV
I believe I may be overlooking something simple in order address this, but I have searched RSeek.org and using "?", but cannot seem to find anything discussing this one. I am using read.csv to read in a csv file. Evidently in places there is nothing between the commas, so that when the data is read in the data.frame produced has values that are empty. Is there a way to fix this when reading the data via "read.csv"? I looked at all the options mentioned in ?read.csv, but did not see anything to address this case, e.g. home,sqr_footage,cost 1,1500,15 2,2000,20 3,,30 4,3500,35 5,4000,45 I would like for the empty cells to have a value of "NA" when they are read in. Thank you for any feedback and insights. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting
Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems that the colour can be mapped to the fac1 variable of "data", compareCats <- function(data) { require(ggplot2) p <- ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) jit <- position_jitter(width = 0.1) p <- p + layer(geom = "jitter", position = jit) + scale_colour_manual(values=c("red", "blue")) print(p) } test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) compareCats(data = test) rem <- runif(5, 1, 100) # randomly remove a few points here and there last_plot() %+% test[-rem,] # replot with new dataset HTH, baptiste 2009/10/6 Bryan Hanson : > Hello Again... I¹m making a faceted plot of a response on two categorical > variables using ggplot2 and having troubles with the coloring. Here is a > sample that produces the desired plot: > > compareCats <- function(data, res, fac1, fac2, colors) { > > require(ggplot2) > p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) > jit <- position_jitter(width = 0.1) > p <- p + layer(geom = "jitter", position = jit, color = colors) > print(p) > } > > test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), > fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) > > compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = > c("red", "blue")) > > Now, if I get away from idealized data where there are the same number of > data points per group (25 in this case), I run into problems. So, if you > do: > > rem <- runif(5, 1, 100) # randomly remove a few points here and there > test <- test[-rem,] > compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = > c("red", "blue")) > > R throws an error due to mismatch between the recycling of colors and the > actual number of data points: > > Error in `[<-.data.frame`(`*tmp*`, gp, value = list(colour = c("red", : > replacement element 1 has 2 rows, need 47 > > I'm new to ggplot2, but have been through the book and the web site enough > to know that my problem is "mapping the varible to the aesthetic"; I also > know I can either "map" or "set" the colors. > > The question, finally: is there an simple/elegant way to map a list of two > colors corresponding to A and B onto any random sample size of A and B with > faceting? If not, and I must "set" the colors: Do I compute the length of > all possible combos of A, B with lrg, sm, and then create one long vector of > colors for the entire plot? I tried something like this, and was not > successful, but perhaps could be with more work. > > All advice appreciated, Bryan (session info below) > > * > Bryan Hanson > Professor of Chemistry & Biochemistry > DePauw University, Greencastle IN USA > >> sessionInfo() > R version 2.9.2 (2009-08-24) > i386-apple-darwin8.11.1 > > locale: > en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] grid datasets tools utils stats graphics grDevices > methods > [9] base > > other attached packages: > [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_2.2.0 > [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 > [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 > robustbase_0.4-5 > [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 > [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 > [21] e1071_1.5-19 class_7.2-48 > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Text editors for Sweave (rnw) files
vim/gvim does syntax highlighting of R, Sweave and latex. On Tue, Oct 6, 2009 at 12:30 PM, Gregory Gentlemen wrote: > Hi fellow R-users, > > Are there any text editors that recognize sweave (.rnw) files? I am running > Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) > doesn't recognize rnw files and does not do any syntax highlighting for them. > > Thanks in advance, > Greg > > > > __ > Make your browsing faster, safer, and easier with the new Internet > Explorer[[elided Yahoo spam]] > com/ca/internetexplorer/ > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Text editors for Sweave (rnw) files
Emacs with ESS would be one way to go. When editing a RNW file in ESS, you can use a key combination to go from RNW directly to PS or PDF, which is nice. Erik > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Gregory Gentlemen > Sent: Tuesday, October 06, 2009 11:31 AM > To: r-help@r-project.org > Subject: [R] Text editors for Sweave (rnw) files > > Hi fellow R-users, > > Are there any text editors that recognize sweave (.rnw) files? I am > running Windows Vista and in the past I used Tinn-R for R files but it > (surprisingly) doesn't recognize rnw files and does not do any syntax > highlighting for them. > > Thanks in advance, > Greg > > > > __ > Make your browsing faster, safer, and easier with the new Internet > Explorer[[elided Yahoo spam]] > com/ca/internetexplorer/ > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Text editors for Sweave (rnw) files
Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __ Make your browsing faster, safer, and easier with the new Internet Explorer[[elided Yahoo spam]] com/ca/internetexplorer/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Date-Time-Stamp input method for user-specific formats
esp wrote: > > For the function as defined above using 'sapply' >> spot[,1] > 01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009 > 00:00:03 > 1251759600 1251759601 1251759602 > 1251759603 > > This was unexpected - it seems to have displayed the datetimestamp values > both as per my defined character-string representation and as numeric > values. > One mystery solved (now I appreciate the existence and utility of the 'str' and 'ls.str' functions), the apparent dual dateformat and numeric results from my initial algorithm were in fact the associated characterstring and numeric parts of a "Named num" object. Hence for example: > str(spot$DATETIME) Named num [1:4] 1.25e+09 1.25e+09 1.25e+09 1.25e+09 - attr(*, "names")= chr [1:4] "01/09/2009" "01/09/2009 00:00:01" "01/09/2009 00:00:02" "01/09/2009 00:00:03" > names(spot$DATETIME) [1] "01/09/2009" "01/09/2009 00:00:01" "01/09/2009 00:00:02" "01/09/2009 00:00:03" -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25770184.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] IRLS or other iteratively re weighted optimization algorithms with constraints in R
On Oct 6, 2009, at 12:14 PM, Corrado wrote: Dear list, is there an iterative re weighted least square based algorithm or any or other iteratively re weighted optimisation algorithms for non linear (and possibly non parametric) optimisation problems with constraints available in R? Have you looked in the suggestively named Task View yet? http://cran.r-project.org/web/views/ http://cran.r-project.org/web/views/Optimization.html -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ggplot2: mapping categorical variable to color aesthetic with faceting
Hello Again... I¹m making a faceted plot of a response on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats <- function(data, res, fac1, fac2, colors) { require(ggplot2) p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit <- position_jitter(width = 0.1) p <- p + layer(geom = "jitter", position = jit, color = colors) print(p) } test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm"), 25))) compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c("red", "blue")) Now, if I get away from idealized data where there are the same number of data points per group (25 in this case), I run into problems. So, if you do: rem <- runif(5, 1, 100) # randomly remove a few points here and there test <- test[-rem,] compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c("red", "blue")) R throws an error due to mismatch between the recycling of colors and the actual number of data points: Error in `[<-.data.frame`(`*tmp*`, gp, value = list(colour = c("red", : replacement element 1 has 2 rows, need 47 I'm new to ggplot2, but have been through the book and the web site enough to know that my problem is "mapping the varible to the aesthetic"; I also know I can either "map" or "set" the colors. The question, finally: is there an simple/elegant way to map a list of two colors corresponding to A and B onto any random sample size of A and B with faceting? If not, and I must "set" the colors: Do I compute the length of all possible combos of A, B with lrg, sm, and then create one long vector of colors for the entire plot? I tried something like this, and was not successful, but perhaps could be with more work. All advice appreciated, Bryan (session info below) * Bryan Hanson Professor of Chemistry & Biochemistry DePauw University, Greencastle IN USA > sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid datasets tools utils stats graphics grDevices methods [9] base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8mvbutils_2.2.0 [5] ChemoSpec_1.1 lattice_0.17-25mvoutlier_1.4 plyr_0.1.8 [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 robustbase_0.4-5 [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 [17] nnet_7.2-48mclust_3.2 MASS_7.2-48lars_0.9-7 [21] e1071_1.5-19 class_7.2-48 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] IRLS or other iteratively re weighted optimization algorithms with constraints in R
Dear list, is there an iterative re weighted least square based algorithm or any or other iteratively re weighted optimisation algorithms for non linear (and possibly non parametric) optimisation problems with constraints available in R? Regards -- Corrado __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tkProgressBar usage
I have a frame and I want to fix the progress bar onto it.I do not want progress bar to display as another GUI.how do i embed progress bar onto a frame ? -- Dipti [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear mixed effects model ?
Daniel Perkins wrote: > > > Ideally we would do an ANCOVA to test for differences in slope or > intercepts for the different streams. However as there were repeated > measures and unequal n and unbalanced design, I have used a linear mixed > effect model (from nlme package in R) in the form: > > model <- lme (Rate ~ Temp* Stream, random = ~ Time|Replicate) > > This should rather be model <- lme (Rate ~ Temp* Stream, random = ~ 1|Time/Replicate) Always start your model with the more parsimonious "equal slopes" assumption denoted by 1|. When you place the Time variable as you did, it estimates separate slopes for Time, which could be ill conditioned. Dieter -- View this message in context: http://www.nabble.com/Linear-mixed-effects-model---tp25767907p25770925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] else if statement error
2009/10/6 Uwe Ligges : > > > Gabor Grothendieck wrote: >> >> 2009/10/6 Uwe Ligges : >>> >>> The first rule is easy: As long as you are using scalar valued (i.e. >>> length >>> 1 vectors in R) "cond", you should prefer >>> if(cond) cons.expr else alt.expr >>> rather than >>> ifelse(cond, yes, no) >>> because the latter one evaluates both "yes" and "no" while the former one >>> evaluates exactly one of both expressions. >> >> I don't think that that is true. The false leg was not evaluated here: >> >>> ifelse(TRUE, { cat("a"); 1}, {cat("b"); 2}) >> >> a[1] 1 > > > Ah, indeed that changed at some point and I forgot that the code checks for > the length of cond nowadays. Thanks for pointing it out. > Modulo NAs, I think it checks whether cond is all TRUEs or all FALSEs and in either of those cases it only evaluates one or the other. Of course if cond is length 1 then it necessary is all TRUE or all FALSE. If its a mixture of TRUE and FALSE then it evaluates both. > ifelse(c(TRUE, TRUE), { cat("a"); 1}, {cat("b"); 2}) a[1] 1 1 > ifelse(c(FALSE, FALSE), { cat("a"); 1}, {cat("b"); 2}) b[1] 2 2 > ifelse(c(TRUE, FALSE), { cat("a"); 1}, {cat("b"); 2}) ab[1] 1 2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 10:34 AM, Jose Quesada wrote: Robert Wilkins gmail.com> writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). By default, 32 bit Windows only gives 2 Gb for all the user processes to share, and saves the rest of memory for itself. You can change this (see the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, and a bit under 4 Gb in 64 bit Windows. Duncan Murdoch While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] linear model with coefficient constraints
Rnewb wrote: > > I would like to perform a regression like the one below: > > lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data) > > However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and > c1+c2+c3 = C, where A, B, > Ravi Varadhan has an example how this could be done with optim http://markmail.org/message/3dd5c4rppt2bjzwj Dieter -- View this message in context: http://www.nabble.com/linear-model-with-coefficient-constraints-tp25769021p25770788.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RES: RES: Plot
Oh yeah, I forgot that, just correct this by: Data<-as.data.frame(matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri","Sat","Sun",56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,l ist(paste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) Data$Hum<-as.numeric(Data$Hum) Data$Temp<-as.numeric(Data$Temp) Then you can plot it. -Mensagem original- De: joris meys [mailto:jorism...@gmail.com] Enviada em: terça-feira, 6 de outubro de 2009 12:08 Para: Rodrigo Aluizio Assunto: Re: [R] RES: Plot On Tue, Oct 6, 2009 at 4:56 PM, Rodrigo Aluizio wrote: > This may work for you. > Then you can custom your graphics with ?par. > > Data<-as.data.frame(matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", > "Sat","Sun",56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,list(pa > ste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) This won't work, as it puts also Temp en Hum as factors. A matrix can only have 1 mode, and the matrix call you do converts everything to factor before you put it in the dataframe. > > plot(Data$Days,Data$Temp) > > -Mensagem original- > De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em > nome de Ashta > Enviada em: terça-feira, 6 de outubro de 2009 11:36 > Para: Sarah Goslee > Cc: R help > Assunto: Re: [R] Plot > > Thanks Sara, > > Yes I did try. I could not get the Days on the X-axis > > blow is theerror message > > plot(Temp,Days) > Error in plot.window(...) : need finite 'ylim' values > In addition: Warning messages: > 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf >> > > > > On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee wrote: > >> Did you try it? With, perhaps, plot() ? And lines() ? >> >> You might do better with Days as a factor with the day names in order. > (And >> why are two full and five abbreviated?) >> >> I don't understand why Hum and Temp are matrices rather than vectors, >> and why then you didn't specify dimensions, and for that matter why you >> are missing a closing paren but do have a comma in its place. >> >> Generally this list is happy to help, but we like some evidence that the >> querent has *tried* before inquiring. >> >> Sarah >> >> On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: >> > Hi All, >> > >> > >> > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", >> > "Sun"),7,1) >> > >> > Hum <-matrix(c(56,57,60,75,62,67,70), >> > >> > Temp<-matrix(c(76,77,81,95,82,77,83), >> > >> > >> > >> > Using the above information I want plot humidity and temperature on >> Y-axis >> > and days on X-axis >> > >> > Any help is appreciated! >> > >> >> -- >> Sarah Goslee >> http://www.functionaldiversity.org >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot cumsum refined question (?)
The date time stamp is not the same? data.frame(as.chron(Cumul[,"date_time"]), DF[,"date_time"]) On Tue, Oct 6, 2009 at 9:31 AM, hadley wickham wrote: >> It is much easier to do you data preparation before plotting. >> >> Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", >> function(x){ >> x$Cummul <- cumsum(x$precipitation) >> x >> }) > > With a little less typing: > > Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", transform, > Cummul = cumsum(precipitation)) > > Hadley > > -- > http://had.co.nz/ > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Letter-based representation of pairwise comparisons
Ok, thanks for all your responses, i was thinking, after reading the firsts messages that use only the $p.value was good. By using a symetric matrix results are ok. It's also good with a pvalue vector (just like exemples in the help ...). many thanks for your help -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25770624.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to fit time varying coefficient regression model?
R_help Help wrote: > > Hi - I read through dse package manual a bit. I'm not quite certain > how I can use it to estimate a time varying coefficient regression > model? I might pick up an inappropriate package. Any suggestion would > be greatly appreciated. Thank you. > > > Just rewrite the linear regression model into state-space equations, and > apply Kalman filtering. See Chapter 16 or 17 in our Analysing Ecological > Data book. There will be packages in R that can do kalman filtering and > smoothing > > Alain > > > > > > rh > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > - Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://www.nabble.com/how-to-fit-time-varying-coefficient-regression-model--tp25762040p25770615.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot
Hi beside other options if you do not want to learn how to order factor levels Days <- c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat","Sun") Hum <-c(56,57,60,75,62,67,70) Temp<-c(76,77,81,95,82,77,83) > limits<-range(c(Hum, Temp)) > limits [1] 56 95 > plot(1:7, Hum, ylim=limits) > points(1:7, Temp, col=2) > plot(1:7, Hum, ylim=limits, axes=F) > points(1:7, Temp, col=2) > axis(1, at=1:7, Days) > axis(2) > box() > this may work for you if you get rid of unnecessary matrix call. Regards Petr r-help-boun...@r-project.org napsal dne 06.10.2009 16:35:44: > Thanks Sara, > > Yes I did try. I could not get the Days on the X-axis > > blow is theerror message > > plot(Temp,Days) > Error in plot.window(...) : need finite 'ylim' values > In addition: Warning messages: > 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf > > > > > > On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee wrote: > > > Did you try it? With, perhaps, plot() ? And lines() ? > > > > You might do better with Days as a factor with the day names in order. (And > > why are two full and five abbreviated?) > > > > I don't understand why Hum and Temp are matrices rather than vectors, > > and why then you didn't specify dimensions, and for that matter why you > > are missing a closing paren but do have a comma in its place. > > > > Generally this list is happy to help, but we like some evidence that the > > querent has *tried* before inquiring. > > > > Sarah > > > > On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: > > > Hi All, > > > > > > > > > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", > > > "Sun"),7,1) > > > > > > Hum <-matrix(c(56,57,60,75,62,67,70), > > > > > > Temp<-matrix(c(76,77,81,95,82,77,83), > > > > > > > > > > > > Using the above information I want plot humidity and temperature on > > Y-axis > > > and days on X-axis > > > > > > Any help is appreciated! > > > > > > > -- > > Sarah Goslee > > http://www.functionaldiversity.org > > > >[[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] GLM quasipoisson error
atorso wrote: > > Hello, > > I'm having an error when trying to fit the next GLM: > >>>model<-glm(response ~ CLONE_M + CLONE_F + HATCHING > +(CLONE_M*CLONE_F) + (CLONE_M*HATCHING) + (CLONE_F*HATCHING) + > (CLONE_M*CLONE_F*HATCHING), family=quasipoisson) >>> anova(model, test="Chi") > > > > > > I guess that those variables are factors, and that you have empty > combinations? Make a coplot, and see whether you have data for all > combinations of the levels of your factors. Formulated differently..does > it make sense, or is it possible to fit the 3-way interaction for your > data? > > Also..you may want to use the str command to see whether "response" is > indeed coded correctly. > > Alain > >>Error in if (dispersion == 1) Inf else object$df.residual : > missing value where TRUE/FALSE needed > > If I fit the same model by using the Poisson distribution, it works. > > I have not a clue about where the problem could be. Do you have any > idea or suggestion I could try? > > Thank you in advance, > > Ana > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > - Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://www.nabble.com/GLM-quasipoisson-error-tp25754404p25770491.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RES: Plot
This may work for you. Then you can custom your graphics with ?par. Data<-as.data.frame(matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat","Sun",56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,list(pa ste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) plot(Data$Days,Data$Temp) -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Ashta Enviada em: terça-feira, 6 de outubro de 2009 11:36 Para: Sarah Goslee Cc: R help Assunto: Re: [R] Plot Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf > On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee wrote: > Did you try it? With, perhaps, plot() ? And lines() ? > > You might do better with Days as a factor with the day names in order. (And > why are two full and five abbreviated?) > > I don't understand why Hum and Temp are matrices rather than vectors, > and why then you didn't specify dimensions, and for that matter why you > are missing a closing paren but do have a comma in its place. > > Generally this list is happy to help, but we like some evidence that the > querent has *tried* before inquiring. > > Sarah > > On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: > > Hi All, > > > > > > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", > > "Sun"),7,1) > > > > Hum <-matrix(c(56,57,60,75,62,67,70), > > > > Temp<-matrix(c(76,77,81,95,82,77,83), > > > > > > > > Using the above information I want plot humidity and temperature on > Y-axis > > and days on X-axis > > > > Any help is appreciated! > > > > -- > Sarah Goslee > http://www.functionaldiversity.org > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there a recent book on Q-Q plot and data visualization in general?
Hi Peng Yu, Chapter 13 of the following book provides a good description of the assumption done when using regression and other techniques. It also discusses the QQplot. @BOOK{Christensen1996, title = {Plane Answers to Complex Questions: The Theory of Linear Models}, publisher = {Springer, New York}, year = {1996}, author = {Ronald Christensen}, edition = {Second}, note = {496p}, } cheers, Paul Peng Yu wrote: Hi, I want to look for some detailed explanation on the properties of Q-Q plot and how the properties are derived. In R, there is the following reference. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. Somebody also mentioned the following book chapter to me. Chambers et al., Graphical methods for Data Analysis, Ch.6. But both books are old. I'm wondering if there is any more recent (therefore, maybe better) books for Q-Q plot, and data visualization in general. Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 'persp' query
David Winsemius wrote: On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote: Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z-axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? ?mtext # and use the adj argument Good idea. This works well if your z-axis is fairly vertical on you plot. -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Is there a recent book on Q-Q plot and data visualization in general?
Hi, I want to look for some detailed explanation on the properties of Q-Q plot and how the properties are derived. In R, there is the following reference. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. Somebody also mentioned the following book chapter to me. Chambers et al., Graphical methods for Data Analysis, Ch.6. But both books are old. I'm wondering if there is any more recent (therefore, maybe better) books for Q-Q plot, and data visualization in general. Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot
Actually, it's a bit more complex than just plot(). First you have to make Days an ordered factor, otherwise you get indeed that error. days <- c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat","Sun") Days <- factor(days,levels=days,ordered=T) Then you want to make a plot with 2 axes, you should check : http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes and reconsider... Kind regards On Tue, Oct 6, 2009 at 4:19 PM, Sarah Goslee wrote: > Did you try it? With, perhaps, plot() ? And lines() ? > > You might do better with Days as a factor with the day names in order. (And > why are two full and five abbreviated?) > > I don't understand why Hum and Temp are matrices rather than vectors, > and why then you didn't specify dimensions, and for that matter why you > are missing a closing paren but do have a comma in its place. > > Generally this list is happy to help, but we like some evidence that the > querent has *tried* before inquiring. > > Sarah > > On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: >> Hi All, >> >> >> Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", >> "Sun"),7,1) >> >> Hum <-matrix(c(56,57,60,75,62,67,70), >> >> Temp<-matrix(c(76,77,81,95,82,77,83), >> >> >> >> Using the above information I want plot humidity and temperature on Y-axis >> and days on X-axis >> >> Any help is appreciated! >> > > -- > Sarah Goslee > http://www.functionaldiversity.org > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot
Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf > On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee wrote: > Did you try it? With, perhaps, plot() ? And lines() ? > > You might do better with Days as a factor with the day names in order. (And > why are two full and five abbreviated?) > > I don't understand why Hum and Temp are matrices rather than vectors, > and why then you didn't specify dimensions, and for that matter why you > are missing a closing paren but do have a comma in its place. > > Generally this list is happy to help, but we like some evidence that the > querent has *tried* before inquiring. > > Sarah > > On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: > > Hi All, > > > > > > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", > > "Sun"),7,1) > > > > Hum <-matrix(c(56,57,60,75,62,67,70), > > > > Temp<-matrix(c(76,77,81,95,82,77,83), > > > > > > > > Using the above information I want plot humidity and temperature on > Y-axis > > and days on X-axis > > > > Any help is appreciated! > > > > -- > Sarah Goslee > http://www.functionaldiversity.org > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Letter-based representation of pairwise comparisons
Please provide a reproducible example. I've had problems with multcompLetters in the past, because I was giving it slightly incorrect input. Hadley On Tue, Oct 6, 2009 at 7:41 AM, goz wrote: > > hello, > > i try to use the multcomp letters, but i have problems with my results : > > here is my pvalue matrix (from a pairwise.t.test) : > > pair=pairwise.t.test(...) > pair$p.value > > 0 B BxS > B 0.01727 - - > BxS 0.00013 0.00226 - > S 0.87555 0.02610 0.00027 > > > i was thiking to have something like that : > 0 B S BxS > a b a c > > but function return : > >> multcompLetters(pair$p.value) > B BxS S > "a" "b" "a" > > > first question : why the 0 traitement doesn't appears in result ? > second : why the results differs than what i expected ? > > many thanks. > > -- > View this message in context: > http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25767357.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
Robert Wilkins gmail.com> writes: > > Will R have more glitches on one operating system as opposed to > another, or is it pretty much the same? > > robert > > One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot cumsum refined question (?)
> It is much easier to do you data preparation before plotting. > > Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", > function(x){ > x$Cummul <- cumsum(x$precipitation) > x > }) With a little less typing: Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", transform, Cummul = cumsum(precipitation)) Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Viewing specific data from a dataframe
If I understand correctly, you can use which( ,arr.ind=TRUE): Assuming that you start with a data frame, dat <- as.data.frame(matrix(runif(30), ncol=5)) nm <- names(dat) cormat <- cor(dat) cormat[lower.tri(cormat, diag=TRUE)] <- NA idx <- which(cormat > 0.4, arr.ind=TRUE) idx cbind(nm[idx[, "row"]], nm[idx[, "col"]]) will give you the pairs. -Peter Ehlers Krystyna Golabek wrote: Dear R users, Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is >0.8? This is the code I'm using to date cor(data, method="spearman") Kind regards Krys _ Save time by using Hotmail to access your other email accounts. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot cumsum refined question (?)
Dear Stephen, It is much easier to do you data preparation before plotting. Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", function(x){ x$Cummul <- cumsum(x$precipitation) x }) ggplot(Cummul, aes(x = date_time, y = Cummul)) + geom_line() + facet_wrap(~gauge_name, scales="free_y") HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research 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 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens stephen sefick Verzonden: dinsdag 6 oktober 2009 16:07 Aan: r-help@r-project.org Onderwerp: [R] ggplot cumsum refined question (?) OK, so maybe last night was a little too much at one throw, so I have reduced the data to two stations- one that has precipitation and one that does not. This is going to be in the context of a larger data set. I would like to be able to issue a ggplot command and have cum sum just act on the facets (factors) to apply this. library(chron) library(ggplot2) DF <- structure(list(date_time = structure(c(14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375, 14523.354167, 14523.364583, 14523.375, 14523.385417, 14523.395833, 14523.40625, 14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522
Re: [R] Plot
Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta wrote: > Hi All, > > > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat", > "Sun"),7,1) > > Hum <-matrix(c(56,57,60,75,62,67,70), > > Temp<-matrix(c(76,77,81,95,82,77,83), > > > > Using the above information I want plot humidity and temperature on Y-axis > and days on X-axis > > Any help is appreciated! > -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] else if statement error
Gabor Grothendieck wrote: 2009/10/6 Uwe Ligges : The first rule is easy: As long as you are using scalar valued (i.e. length 1 vectors in R) "cond", you should prefer if(cond) cons.expr else alt.expr rather than ifelse(cond, yes, no) because the latter one evaluates both "yes" and "no" while the former one evaluates exactly one of both expressions. I don't think that that is true. The false leg was not evaluated here: ifelse(TRUE, { cat("a"); 1}, {cat("b"); 2}) a[1] 1 Ah, indeed that changed at some point and I forgot that the code checks for the length of cond nowadays. Thanks for pointing it out. Best wishes, uwe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: Long for Loop- calling C from R - Parallel Computing
-- Forwarded message -- From: Antonio Paredes Date: Tue, Oct 6, 2009 at 9:41 AM Subject: Re: [R] Long for Loop- calling C from R - Parallel Computing To: Karl Ove Hufthammer Hello again, I'm hoping to get a response from some of the R gurus in this list. Is my assumption that R is not designed or build to deal with high levels (a lots of simulated data) simulation correct. For example, how to minimize system time; do one have to call a lower level language like C or Fortran; or just, like many of you have done, do a lots of programing in R and eventually the tricks will be learned. Thanks On Mon, Oct 5, 2009 at 8:35 AM, Antonio Paredes wrote: > In my case it does, because I need to preserved a "high level" of > independence (lack of correlation) among the different groups of 60. Also, > when I say final result I mean computation of standard errors and that > source of stuff; sorry about the lack clarity in my statement. > > > On Mon, Oct 5, 2009 at 9:48 AM, Karl Ove Hufthammer wrote: > >> In article <6f6f0fd60910050629p28c99209jcd7836353fd2d754 >> @mail.gmail.com>, antonioparede...@gmail.com says... >> > I'm running the following for loop to generate random variables in >> chunks of >> > 60 at a time (l), here h is of order in millions (could be 5 to 6 >> millions), >> > note that generating all the variables at once could have an impact on >> the >> > final results >> >> No, it will not. See this example code for an illustration: >> >> set.seed(1) >> rnorm(3) >> rnorm(3) >> set.seed(1) >> rnorm(6) >> >> So if you generate the six numbers three at a time or all at once gives >> exactly the same result. >> >> So my suggestion is to generate all the numbers at once. That takes next >> to no time. Or, if it takes too much memory, generate for example a >> million at once, and repeat a few times. >> >> -- >> Karl Ove Hufthammer >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > -Tony > -- -Tony -- -Tony [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ggplot cumsum refined question (?)
OK, so maybe last night was a little too much at one throw, so I have reduced the data to two stations- one that has precipitation and one that does not. This is going to be in the context of a larger data set. I would like to be able to issue a ggplot command and have cum sum just act on the facets (factors) to apply this. library(chron) library(ggplot2) DF <- structure(list(date_time = structure(c(14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375, 14523.354167, 14523.364583, 14523.375, 14523.385417, 14523.395833, 14523.40625, 14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375), format = structure(c("m/d/y", "h:m:s"), .Names = c("dates", "times")), origin = structure(c(1, 1, 1970), .Names = c("month", "day", "year")), class = c("chron", "dates", "times")), gauge = c(2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908