Re: [Rd] wishlist: decreasing argument to is.unsorted
The more general alternative Gabor in this case would be a stopif() function... I often find myself having to think too much with stopifnot(!is.X()) Sean On 4 January 2014 00:24, Gábor Csárdi csardi.ga...@gmail.com wrote: While we are here, how about an is.sorted() function? It is trivial and helps readability a lot imho. Then one does not have to write things like stopifnot(!is.unsorted(x)) but can write stopifnot(is.sorted(x)) instead. Gabor On Fri, Jan 3, 2014 at 1:40 PM, Patrick Burns pbu...@pburns.seanet.com wrote: I've just realized that it could be handy to have a 'decreasing' argument in 'is.unsorted'. And I'm cheekily hoping someone else will implement it. It is easy enough to work around (with 'rev'), but would be less hassle with an argument. The case I have in mind uses 'is.unsorted' in 'stopifnot'. Pat -- Patrick Burns pbu...@pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R Inferno' 'Tao Te Programming') __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Huge performance difference between implicit and explicit print
Minor point and probably not relevant to the speed issue, but df() is the density function for the F distribution, so I have (recently) stopped using it for referring to data.frames. Sean On 30 October 2013 23:32, Gabriel Becker gmbec...@ucdavis.edu wrote: Hadley, As far as I can tell from a quick look, it is because implicit printing uses a different mechanism which does a fair bit more work. From comments in print.c in the R sources: * print.default() - do_printdefault (with call tree below) * * auto-printing - PrintValueEnv * - PrintValueRec * - call print() for objects * Note that auto-printing does not call print.default. * PrintValue, R_PV are similar to auto-printing. PrintValueEnv includes, among other things, checks for functions, S4 objects, and s3 objects before constructing (in C code) an R call to print for S3 objects and show for S4 objects and evaluating it using Rf_eval. So there is an extra trip to the R evaluator. I imagine that extra work is where the hangup is but that is a slightly-informed guess as I haven't done any detailed timings or checks. Basically my understanding of the processes is as follows: print(df) print call is evaluated, S3 dispatch happens, print.default in C is called, result printed to terminal, print call returns df expression df evaluated, auto-print initiated, type of object returned by expression is determined, print call is constructed in C code, print call is evaluated in C code, THEN all the stuff above happens. I dunno if that helps or not as I can't speak to how to change/fix it atm. ~G On Wed, Oct 30, 2013 at 3:22 PM, Hadley Wickham h.wick...@gmail.com wrote: Hi all, Can anyone help me understand why an implicit print (i.e. just typing df at the console), is so much slower than an explicit print (i.e. print(df)) in the example below? I see the difference in both Rstudio and in a terminal. # Construct large df as quickly as possible dummy - 1:18e6 df - lapply(1:10, function(x) dummy) names(df) - letters[1:10] class(df) - c(myobj, data.frame) attr(df, row.names) - .set_row_names(18e6) print.myobj - function(x, ...) { print.data.frame(head(x, 2)) } start - proc.time(); df; flush.console(); proc.time() - start # user system elapsed # 0.408 0.557 0.965 start - proc.time(); print(df); flush.console(); proc.time() - start # user system elapsed # 0.019 0.002 0.020 sessionInfo() # R version 3.0.2 (2013-09-25) # Platform: x86_64-apple-darwin10.8.0 (64-bit) # # locale: # [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 # # attached base packages: # [1] stats graphics grDevices utils datasets methods base Thanks! Hadley -- Chief Scientist, RStudio http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Gabriel Becker Graduate Student Statistics Department University of California, Davis [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Possible POSIXlt / wday glitch bugs.r-project.org status
Some people (luckily not me anymore!) working with mortgages and pensions need to calculate up to 40 years into the future for the payment schedule. On 5 October 2013 02:37, Joshua Ulrich josh.m.ulr...@gmail.com wrote: On Fri, Oct 4, 2013 at 8:02 PM, Imanuel Costigan i.costi...@me.com wrote: Thanks for the responses and quoting the timezone help file. I am assuming that in order to determine the wday element of POSIXlt, R does the necessary calculations in Julian time (via POSIXct). Based on this excerpt from ?DateTimeClasses, it looks like R is responsible for determining time zones post 2037 (the example I gave was in 2038). So it could be an R issue. It's an issue with size of the largest number you can store in a signed integer, which is not specific to R. .POSIXct(.Machine$integer.max, tz=UTC) [1] 2038-01-19 03:14:07 UTC Dates larger than that cannot be represented by a signed integer. It could be worked around, but it's not trivial because R would have to use something other than the tm C struct. Luckily, there's a decade or two before it starts to become a pressing issue. :) ‘POSIXct’ objects may also have an attribute ‘tzone’, a character vector of length one. If set to a non-empty value, it will determine how the object is converted to class ‘POSIXlt’ and in particular how it is printed. This is usually desirable, but if you want to specify an object in a particular timezone but to be printed in the current timezone you may want to remove the ‘tzone’ attribute (e.g. by ‘c(x)’). Unfortunately, the conversion is complicated by the operation of time zones and leap seconds (24 days have been 86401 seconds long so far: the times of the extra seconds are in the object ‘.leap.seconds’). **The details of this are entrusted to the OS services where possible. This always covers the period 1970-2037, and on most machines back to 1902 (when time zones were in their infancy). Outside the platform limits we use our own C code. On 05/10/2013, at 12:59 AM, Scott Kostyshak skost...@princeton.edu wrote: On Fri, Oct 4, 2013 at 6:11 AM, Imanuel Costigan i.costi...@me.com wrote: Wanted to raise two questions: 1. Is bugs.r-project.org down? I haven't been able to reach it for two or three days: Yes. Quote from Duncan: ... the server is currently down. The volunteer who runs the server is currently away from his office, so I expect it won't get fixed until he gets back in a few days. https://stat.ethz.ch/pipermail/r-help/2013-October/360958.html Scott ``` ping bugs.r-project.org PING rbugs.research.att.com (207.140.168.137): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3 Request timeout for icmp_seq 4 Request timeout for icmp_seq 5 Request timeout for icmp_seq 6 ``` 2. Is wday element of POSIXlt meant to be timezone invariant? You would expect the wday element to be invariant to the timezone of a date. That is, the same date/time instant of 5th October 2013 in both Australia/Sydney and UTC should be a Saturday (i.e. wday = 6). And indeed that is the case with 1 min past midnight on 5 October 2013: ``` library(lubridate) d_utc - ymd_hms(2013100501, tz='UTC') d_local - ymd_hms(2013100501, tz='Australia/Sydney') as.POSIXlt(x=d_utc, tz=tz(d_utc))$wday # 6 as.POSIXlt(x=d_local, tz=tz(d_local))$wday # 6 ``` But this isn't always the case. For example, ``` d_utc - ymd_hms(2038100201, tz='UTC') d_local - ymd_hms(2038100201, tz='Australia/Sydney') as.POSIXlt(x=d_utc, tz=tz(d_utc))$wday # 6 as.POSIXlt(x=d_local, tz=tz(d_local))$wday # 5 ``` Is this expected behaviour? I would have expected a properly encoded date/time of 2 Oct 2038 to be a Saturday irrespective of its time zone. Obligatory system dump: ``` sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin12.4.0 (64-bit) locale: [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lubridate_1.3.0 testthat_0.7.1 devtools_1.3 loaded via a namespace (and not attached): [1] colorspace_1.2-4 dichromat_2.0-0digest_0.6.3 evaluate_0.5.1 [5] ggplot2_0.9.3.1grid_3.0.1 gtable_0.1.2 httr_0.2 [9] labeling_0.2 MASS_7.3-29memoise_0.1munsell_0.4.2 [13] parallel_3.0.1 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 [17] RCurl_1.95-4.1 reshape2_1.2.2 scales_0.2.3 stringr_0.6.2 [21] tools_3.0.1whisker_0.3-2 ``` Using R compiled by homebrew [1]. But also experiencing the same bug using R installed on Windows 7 from the CRAN binaries. For those interested, I've also noted this on the `lubridate` Github issues page [2], even though
[Rd] broken link in docs for Binormial functions
On the local documentation page for Binomial, i.e. http://127.0.0.1:/library/stats/html/Binomial.html The link to Catherine Loader's paper Catherine Loader (2000). *Fast and Accurate Computation of Binomial Probabilities*; available from http://www.herine.net/stat/software/dbinom.html.; appears to be broken. Kind regards, Seán [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Issue with Control-Z in a text file on Windows - readLines() appears to truncate
Working on Windows I have had to deal with CSV files that, unfortunately, contain embedded Control-Zs, i.e. ASCII character 26 in decimal, and the readLines() function in R on Windows (2.15.2 and 3.0.0) appears to truncate at the control-Z. There is no problem at all on Ubuntu Linux with R 3.0.0. Am I mistaken or is this genuine? # Create a small file with embedded Control-Z h3 - paste('1,34,44.4,', rawToChar(as.raw(c(65, 26, 65))), ',99') h3 # 1,34,44.4,\ A\032A \,99 writeLines(h3, 'h3.txt') # now attempt to read the file back in h3a - readLines('h3.txt') # but on Windows 2.15.2 and 3.0.0 I get the message #Warning message: #In readLines(h3.txt) : incomplete final line found on 'h3.txt' h3a # [1] 1,34,44.4,\ A # so it drops from the Control-Z onwards # The following is my rough and ready workaround - I'm sure there is a cleaner way fnam - 'h3.txt' tmp.bin - readBin(fnam, raw(), size=1, n=max(2*file.info(fnam)$size, 100)) tmp.char - rawToChar(tmp.bin) txt - unlist(strsplit(tmp.char, '\r\n', fixed=TRUE)) txt # [1] 1,34,44.4,\ A\032A \,99 This was on 64-bit R on a 64-bit Windows 7, but it also appears to be the case in a 32-bit R 2.15.2 on 32-bit Windows-7 inside in a VirtualBox. Kind regards, Sean O'Riordain Trinity College Dublin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Fwd: R unzip method gives filenames as character
Question: would it be better if the contents list of the unzip() function returned the filenames as character rather than factor since they are probably unique strings? tmp - unzip(fnam, list=TRUE) str(tmp) 'data.frame': 31 obs. of 3 variables: $ Name : Factor w/ 31 levels fred1.csv,..: 1 2 3 4 5 6 7 8 9 10 ... $ Length: num 424486 2664277 219798 442383 480857 ... $ Date : POSIXct, format: 2012-12-01 04:05:00 2012-12-02 04:06:00 2012-12-03 04:45:00 2012-12-04 03:52:00 ... thanks, Sean [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] possible minor doc clarification?
Good afternoon, As a clarification does it make sense to remove the second 'not' in the 'See Also' documentation for file_test ? Kind regards, Sean O'Riordain - Index: src/library/utils/man/filetest.Rd === --- src/library/utils/man/filetest.Rd (revision 55639) +++ src/library/utils/man/filetest.Rd (working copy) @@ -35,7 +35,7 @@ } \seealso{ \code{\link{file.exists}} which only tests for existence - (\code{test -e} on some systems) but not for not being a directory. + (\code{test -e} on some systems) but not for being a directory. \code{\link{file.path}}, \code{\link{file.info}} } [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] R command line and pipe using in Linux?
Good afternoon Hang, This is an example of what I've done with a csv file with a header which is too big to read into memory. # this is a file with about 50 columns and 28 million records ap.fnam - 'p2_all28m_records.csv' # lets just explore the columns in Addresspoint... # by reading in the header and the first row p1 - read.csv(ap.fnam, nrows=1) # now which columns do we actually want? # ok... in this case we only want the NCAT column... cols.reqd - grep('NCAT', names(p1)) # so we create a list containing this/these column(s) as a 'character' # type and all other columns as 'NULL'... col.classes - ifelse(seq(ncol(p1)) %in% cols.reqd, 'character', 'NULL') # this will likely take a little over a minute! p9 - read.csv(ap.fnam, colClasses=col.classes ) Hope this helps Kind regards, Sean On 14 February 2011 17:40, Hang PHAN hangp...@gmail.com wrote: Hi, I have a very large data file(GB) from which I only want to extract one column to draw histogram. This would be done several times, so I would like to ask if there is anyway to plot this using R from the linux command line, something look like this cut -f1 xxx.txt |RplotHist Thanks and hope to hear from you. Best regards, Hang [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] possible minor mis-spelling in R Data Import/Export
Good morning, Could this be a mis-spelling in the development (revision 53854) and release version of R Data Import/Export ? Kind regards, Sean O'Riordain Dublin un-affiliated... svn diff r-devel/R/doc/manual/ Index: r-devel/R/doc/manual/R-data.texi === --- r-devel/R/doc/manual/R-data.texi(revision 53854) +++ r-devel/R/doc/manual/R-data.texi(working copy) @@ -1252,7 +1252,7 @@ object, and then a call to @code{dbConnect} opens a database connection which can subsequently be closed by a call to the generic function @code{dbDisconnect}. Use @code{dbDriver(Oracle)}, -...@code{dbddriver(PostgreSQL)} or @code{dbDriver(SQLite)} with those +...@code{dbdriver(PostgreSQL)} or @code{dbDriver(SQLite)} with those DBMSs and packages @pkg{ROracle}, @pkg{RPostgreSQL} or @pkg{RSQLite} respectively. [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] GPL and R Community Policies (Rcpp)
Good morning Dominick, I don't use the Rcpp package and have only the vaguest notions of its history. One of your requests is that your name might be removed from the project as you no longer wish to be associated with it. However, I suspect that it is simply not legal to remove your copyright notice once the project has been distributed. The only way this could happen is if the project is completely rewritten from scratch by people who have not worked on the project using a 'clean-room' methodology - this seems quite unlikely. Just a thought, Kind regards, Sean O'Riordain Dublin On 2 December 2010 04:29, Adrian Dragulescu adria...@eskimo.com wrote: Dominick, I don't use the Rcpp package but I have been aware of the changes made to the package over the years. I don't see what you are after. I don't consider the mention about your contribution in the authors section disparaging in ANY way. It seems reasonable that as the code base grows, your initial contribution to have a smaller and smaller share. That's all it says. If you would start contributing again to the package development, I'm sure that line can be changed. Romain has gone from 0% to a sizeable share in a quick period with some great contributions. Other authors seem to find a way to contribute to the project too. If it's peer recognition you're after, everybody on this list is already aware that you're the original developer of the package. I personally still have a good memory so I don't need another reminder email on this topic. I'm sure there are other projects that you can work on, alone or with collaborators, that would benefit the R community. Cheers, Adrian On Wed, 1 Dec 2010, Dominick Samperi wrote: This post asks members of the R community, users and developers, to comment on issues related to the GNU Public License and R community policies more generally. The GPL says very little about protecting the the rights of original contributors by not disseminating misleading information about them. Indeed, for pragmatic reasons it effectively assumes that original authors have no rights regarding their GPL-ed software, and it implicitly leaves it up to the community of developers and users to conduct themselves in a fair and reasonable manner. After discussing these matters with Richard Stallman I think we more-or-less agreed that a GPL copyright notice is nothing more than a way to deputise people to serve as protectors of the principles of the Free Software Foundation (FSF). It has nothing to do with protecting the rights or the ideas of original contributors. There is no peer review, no requirement to explain your contributions, and anybody can essentially do as they please with the software provided they retain the copyright/FSF deputy notice---of course, you can always work-around this last restriction by modifying the implementation and placing it in a new file, because nobody is checking (GPL doesn't require it). The GPL is all about freedom, not responsibility. It is entirely focused on deregulation, not on the protection of intellectual property or professional reputations. It serves the useful purpose of making great software more widely available, but it does not dictate how people should behave and should not be used as a moral compass. (See recent book titled You are not a gadget: a manifesto, a rejoinder to the GNU manifesto.) As a counterbalance I think the community of developers and users need to play a more active role in the evolution of shared values and expectations. In this spirit I respectfully request that the R community consider the following. The author line of the latest release of the R package Rcpp (0.8.9) was revised as follows: From: based on code written during 2005 and 2006 by Dominick Samperi To: a small portion of the code is based on code written during 2005 and 2006 by Dominick Samperi As it is highly unusual (and largely impossible) to quantify the relative size of the the contribution made by each author of GPL'ed software, this has effectively changed an acknowledgment into a disparaging remark. It is also misleading, because I am the original creator of the Rcpp library and package (it was forked by Dirk Eddelbuettel and is now effectively part of R core development). Incidentally, the README file for Rcpp 0.6.7 shows that my contributions and influence were not confined to the period 2005-2006. A look at the change history of Rcpp would quickly reveal that to be fair other authors of Rcpp (and perhaps other R package authors) should have their contributions qualified with a small portion of the code, or administered by, but this is precisely the kind of monitoring that inspired Richard Stallman to say we must chuck the masks in the GNU Manifesto. It is obviously a great benefit for the R community to have Rcpp actively supported by the R core team. I am very grateful for this. What I do
Re: [Rd] sample on data.frame
Good morning Stavos, I currently use the following definition in my own environment. sample.df - function (df, n = 3) { df[sample(nrow(df), min(nrow(df), n)), ] } I also added in the possibility of returning n sequential rows which I used when examining address files... but I haven't used it in ages :-) Kind regards, Sean O'Riordain Dublin Ireland On Fri, Feb 19, 2010 at 9:05 PM, Stavros Macrakis macra...@alum.mit.eduwrote: Currently, sample of a data.frame is a sample of the columns: e.g. sample(data.frame(a=1,b=2:3,c=4),2) = data.frame(b=2:3,c=c(4,4)) I'd have thought it would be much more common to want a sample of the rows. It's easy enough to define an appropriate function for this: sample.data.frame - function(x,size,replace=FALSE,prob=NULL) # no auto-dispatch; sample is not a generic function { x[sample(nrow(x),size,replace,prob),] } Would it be a bad idea for this to be the standard behavior for sample? There is always, of course, the backwards-compatiblity argument. Is sample in fact used in practice to select random columns? I realize it is hard to quantify that, but perhaps there is some wisdom in the community about that. -s [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rcpp: Clarifying the meaning of GPL?
Good afternoon, While I don't know the history of this particular conflict - to me the entire *purpose* of the GPL is to ALLOW forking of code which must remain in public. If somebody forks code and makes any change whatsoever and then distributes either the diff or the entire previous project, then they can (and probably should) add their name as a copyright holder to the copyrights of previous contributors. They cannot however remove previous copyright holders names so easily. It should be noted that having multiple independent copyright holder names on a GPL project is normally held as a positive thing - it makes it much harder to un-GPL the project. Kind regards, Sean On Wed, Dec 23, 2009 at 4:05 PM, Dominick Samperi djsamp...@earthlink.net wrote: In my view what has happened is not much different from a situation where I place my name as co-author on a research paper that you have created, without your permission, after making a few small edits that you may not agree with. Furthermore, if you complain I simply present the results (at conferences) as my own without mentioning your name. Is this just a dispute between implementers? Stavros Macrakis wrote: On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi djsamp...@earthlink.net mailto:djsamp...@earthlink.net wrote: Stavros Macrakis wrote: That said, as a matter of courtesy and clarity, I'd think that a fork should use a different name. Yes, the point is that this is not a legal or technical matter, it is a matter of professional courtesy. I take this as one vote for the name change. The naming and maintenance history of this package (or these packages: Rcpp and RcppTemplate) appears to be complicated, and I have no interest in becoming an arbitrator or voter in what is a dispute between you and other implementers. On US copyright law, this should not be confused with copyright notices that appear in GPL source code. Remember that these are really copyleft notices, and copyleft is designed to protect the rights of copiers, not original contributors. The copyright notice is a correct and legally valid copyright notice. The GPL (copyleft) is the copyright *license*. Like all licenses, it defines the relationship between authors and copiers. The GPL explicitly avoided the so-called obnoxious BSD advertising clause, which has requirements about giving credit. -s __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Windows Laptop specification query
Good morning Keith, Have a look at http://cran.r-project.org/bin/windows/base/rw-FAQ.html#There-seems-to-be-a-limit-on-the-memory-it-uses_0021 The short answer is that it depends... a) memory is limited under windows b) R is essentially a serial program - HOWEVER it depends what you're actually doing - if you're working with large matrices then there are parallel versions of BLAS that can be used... On a multi-core windows machine with lots of memory you can of course run up multiple copies of R and run each independently Kind regards, Sean On Mon, Sep 28, 2009 at 4:40 AM, Keith Satterley ke...@wehi.edu.au wrote: I've read some postings back in 2002/2006 about running R on multiple core CPUs. The answer was basically separate processes work fine, but parallelization needs to be implemented using snow/rmpi. Are the answers still the same? I ask because we are about to order a laptop running Windows for a new staff member. Some advice on the following would be helpful. It will be ordered with Vista, with a free upgrade to Windows 7. It will have 8GB of memory A quad core CPU costs about AUD$1100 more than the fastest (Intel T9900-6M Cache, 3.06 GHz) dual core CPU. I'm wondering if there is value in ordering the quad core. We are looking at a time frame of 3-4 years. Is anyone aware of near future plans to implement some form or parallelization that would more or less be hidden from the normal user? It is anticipated that analysis of Next Gen sequence data will be important. I've read the Windows FAQ about running R under Vista. We will probably start with Vista. I've read some posts in R-devel indicating people are running R under Windows 7. Is it safe to assume that R will run under Windows 7 after it is released? We are hoping to make use the 8GB of memory. Am I right in assuming that when the 64 bit version of Windows 7 is available, it will allow R users to make good use of the 8GB of memory. Does this happen under the current higher end versions of 64 bit Vista? cheers, Keith Keith Satterley Bioinformatics Division The Walter and Eliza Hall Institute of Medical Research Parkville, Melbourne, Victoria, Australia __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] incorrect result (41/10-1/10)%%1 (PR#13863)
Good morning Jan, Could this be covered off by the following? http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Kind regards, Sean On Sat, Aug 1, 2009 at 9:05 PM, jan.hattend...@unibas.ch wrote: Full_Name: jan hattendorf Version: 2.9.0 OS: XP Submission from: (NULL) (213.3.108.185) I get an incorrect result for (41/10-1/10)%%1 [1] 1 The error did not occur with other numbers than 41 (1, 11, 21, 31, 51, ...) test - rep(NA, 1000) for(i in 1:1000){ test[i] - i/10-1/10 } test[test%%1==0] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 2009 Wish list for R
Can I add a windows specific wish please? I'd like to be able to double click on a word in the console and select it, rather than have to manually select - silly I know but I'm constantly going back and forth between R and other programs where I can do this and I still haven't managed to train my hand not to double click words in R... :-) Thanks R-Core! On Sat, Jan 17, 2009 at 1:57 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: 2009 Wish list for R (no particular order): - some way of placing backslashes in literal strings without escaping them. Useful for latex, regular expressions and Windows file paths. This seems to come up from time to time on the lists. Ruby, python, Perl and other scripting languages have various ways to handle this which might be used as a model. - in Windows, some way to tell Packages | Install menu to use dependencies = TRUE (vs. dependencies = NA now). NB. utils:::menuInstallPkgs is the R routine invoked - self-contained R executables - default origin in Date. as.numeric.Date and as.Date.numeric are asymmetric in this respect. - here documents in sourced input - read.table(textConnection(Lines)) later gives annoying warning message about closing connection. If too hard to fix add an asText= arg, e.g. read.table(Lines, asText=TRUE) - View() buttons to copy to clipboard. (print and save might also be nice.) - allow library() command to determine what is imported like python's import ... from ... - Lag function(x, k, ...) lag(x, -k, ...) lag is regarded by many as confusing and this would give a second option while keeping lag for compatability. - generic filter() - add executable for filefind.cc in docs.miktex.org to R bin directory on Windows to give an easy way to locate MiKTeX. Alternately put it in Rtools. - real subclassing of environments - ability to conditionally emit portions of a Sweave document even if they represent both text and code portions without using crude workarounds. For example if all the data for a certain figure is missing that figure and the associated paragraphs describing it and the R code shown associated with it could all be suppressed dynamically. - pfg TeX driver __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] minor typo in duplicated.Rd (lemgth != length)
s...@sean7:~/R/RSVN/R/trunk/src/library$ svn diff Index: base/man/duplicated.Rd === --- base/man/duplicated.Rd (revision 47231) +++ base/man/duplicated.Rd (working copy) @@ -64,7 +64,7 @@ not be efficient for a very large set. } \value{ - For a vector input, a logical vector of the same lemgth as + For a vector input, a logical vector of the same length as \code{x}. For a data frame, a logical vector with one element for each row. For a matrix or array, a logical array with the same dimensions and dimnames. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] trivial spelling correction
Good evening, Spotted a very minor spelling mistake in the source for the grep help. And thanks to R-Core for all their work - it's a tribute to R-Core, that these sort of problems are rare indeed. Best regards, Sean O'Riordain Dublin [EMAIL PROTECTED]:~/R/RSVN/R/trunk/src/library/base/man$ svn diff Index: grep.Rd === --- grep.Rd (revision 47031) +++ grep.Rd (working copy) @@ -102,7 +102,7 @@ For \code{sub} and \code{gsub} a character vector of the same length and with the same attributes as \code{x} (after possible coercion). - Elements of character vectors \code{x} which are not subsituted will + Elements of character vectors \code{x} which are not substituted will be return unchanged (including any declared encoding). If \code{useBytes = FALSE}, either \code{perl = TRUE} or \code{fixed = TRUE} and any element of \code{pattern}, \code{replacement} and __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Posting Guide
Gabor, I agree. Furthermore I think it might be useful to add that in my experience (and I'm sure others as well) that the process of creating a simple reproduceable example for an email to r-help will in most cases clarify what I'm trying to do and actually solve my own problem for me - once or twice I've been tempted to email my problem and my own solution for the archive. As a side note I tend to put a fair bit of work (i.e. measured in days of calendar time and hours of work) for fear of being abused on the list for not doing enough prep work. Fear is probably not the idea motivator though... Regards, Sean 2008/6/6 Gabor Grothendieck [EMAIL PROTECTED]: People read the posting guide yet they are still unable to create an acceptable post. e.g. https://stat.ethz.ch/pipermail/r-help/2008-June/164092.html I think the problem is that the guide is not clear or concise enough. I suggest we add a summary at the beginning which gets to the heart of what a poster is expected to provide: Summary To maximize your change of getting a response when posting provide (1) commented, (2) minimal, (3) self-contained and (4) reproducible code. (This one line summary also appears at the end of each message to r-help.) Self-contained and reproducible mean that a responder can copy the questioner's code to the clipboard, paste it into their R session and see the same problem you as the questioner see. Note that dput(mydata) will display mydata in a reproducible way. Self-contained and reproducible are needed because: (1) Self-Effort. It shows that the questioner tried to solve the problem by themself first. (2) Test framework. Often the responder needs to play with the code a bit in order to respond or at least to give the best answer. They can't do that without a test framework that includes the data and the code to run it and its not fair to ask them to not only answer the question but also to come up with test data and to complete incomplete code. (3) Archives. Questions and answers go into the archives so they are not only for the benefit of of the questioner but also for the benefit of all future searchers of the archive. That means that its not finished if you have solved the problem for yourself. You still need to ensure that the thread has a complete solution. (For that reason its also important to give a meaningful subject to each post.) Commented and minimal also reduce the time it takes to understand the problem. Don't just dump your code as is into the message since you are just wasting your own time. Its not likely anyone will answer a message if the questioner has not taken the time to reduce it to its essential elements. Surprisingly, quite often understanding what the problem is takes the responder most of the time -- not solving the problem. Once the question is actually understood its often quite fast to answer. Thus in addition to posting it in a minimal form, comment on it sufficiently so that the responder knows what the code does and is intended to produce. It may be obvious to the questioner who is embroiled in the problem but that does not mean its obvious to others. Introduction rest of posting guide ... __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] cpu usage high with windows change dir / winDialogString (PR#11045)
I did a few other places where askstring() is used, e.g. Help / apropos... and friends. No problem Duncan if you decide not to fix. It's one of those it'd be nice if it was fixed - but it's not a problem if it doesn't bugs... :-) and now that I have a modern (i.e. 5 year old Linux machine) at home I'm no longer reliant on the ancient laptop for everyday use! All the best, Sean On 29/03/2008, Duncan Murdoch [EMAIL PROTECTED] wrote: On 29/03/2008 1:10 PM, Sean O'Riordain wrote: Hi Duncan, I suspect that it's not the SHBrowseForFolder call as it seems fine once the Browse button is pressed - the problem occurs *before* the Browse button is pressed. The Change Dir dialog in R 2.7.0 no longer uses the winDialogString()-like dialog, so the problem will go away in that one case, but any other user of the underlying code will still have the problem. It's because that function sets up a loop to poll for results. Doesn't really seem worth the trouble to fix. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] cpu usage high with windows change dir / winDialogString (PR#11045)
Good afternoon Duncan, Thanks for that. See below for my reply. Best Regards, Sean On 29/03/2008, Duncan Murdoch [EMAIL PROTECTED] wrote: On 28/03/2008 12:05 PM, [EMAIL PROTECTED] wrote: Good afternoon, This is possibly a windows only bug, definitely of comparatively low importance - but for the sake of completeness here we go. I've searched http://bugs.R-project.org/ etc., but can find no mention. For RGui.exe, the CPU usage goes to 100% for certain dialog boxes for the duration that the dialog box is visible, e.g. * check CPU usage is low * On the RGui.exe menu chose File / Change dir... * the CPU usage goes to 100% * hit OK * the CPU usage goes back down again What is the bug here? I'd guess it's not R using the cpu, rather some other process hooked to the dialog, but even if it really is R, why is this a bug? Using Taskmanager it shows that RGui.exe is using 92-95% CPU while the winDialogString() is open and 0% when the dialog is closed or a different R dialog is used e.g. winDialog(yesnocancel, Do you agree?). The bug is that the cpu usage is unusually high - by comparison for other dialogs e.g. File / Open script... the cpu usage stays low - for other windows applications it is not normal for cpu usage to be at 100% while waiting for user input - on slower machines (e.g. my ancient laptop) this can bring the machine to its' knees (almost) for the short duration that the dialog is open! If I select the Browse button, the cpu usage for RGui.exe falls away to 0% so it is only during the period that R is waiting for the user to fill in the dialog. Not an important bug by any means! Best regards, Sean __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] cpu usage high with windows change dir / winDialogString (PR#11045)
Hi Duncan, I suspect that it's not the SHBrowseForFolder call as it seems fine once the Browse button is pressed - the problem occurs *before* the Browse button is pressed. Regards, Sean On 29/03/2008, Duncan Murdoch [EMAIL PROTECTED] wrote: On 29/03/2008 12:23 PM, Gabor Grothendieck wrote: On Sat, Mar 29, 2008 at 12:06 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 28/03/2008 12:05 PM, [EMAIL PROTECTED] wrote: Good afternoon, This is possibly a windows only bug, definitely of comparatively low importance - but for the sake of completeness here we go. I've searched http://bugs.R-project.org/ etc., but can find no mention. For RGui.exe, the CPU usage goes to 100% for certain dialog boxes for the duration that the dialog box is visible, e.g. * check CPU usage is low * On the RGui.exe menu chose File / Change dir... * the CPU usage goes to 100% * hit OK * the CPU usage goes back down again What is the bug here? I'd guess it's not R using the cpu, rather some other process hooked to the dialog, but even if it really is R, why is this a bug? Maybe R is sitting in a loop consuming all the resources of the system? It's a SHBrowseForFolder call, with a callback. If there's a bug, it looks to me as though it's in Windows. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel