[Rd] Incomplete ouput with sink and split=TRUE e.g. with writeLines (PR#10713)
Full_Name: Jean-Olivier Irisson Version: 2.6.1 OS: OS X 10.5.1, Linux FC 8 Submission from: (NULL) (194.167.139.32) Example steps: > sink("test1.txt") > cat("foo\n") > writeLines("bar\n") > sink() > sink("test2.txt", split=T) > cat("foo\n") foo > writeLines("bar\n") > sink() And the content of the files are: $ head test* ==> test1.txt <== foo bar ==> test2.txt <== foo bar So all the output is correctly directed to the file connection but only some of it is directed to the console (cat but not writeLines). This can be a problem with writeLines but Duncan Murdoch on R-help stated that: "it is probably a sign of a bigger problem in sink()". Real life example: > sink("test3.txt", split=T) > t.test(runif(10),round(runif(10)*2)) data: runif(10) and round(runif(10) * 2) alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.9403446 0.2048443 sample estimates: mean of x mean of y 0.5322499 0.900 > sink() $ head test3.txt Welch Two Sample t-test data: runif(10) and round(runif(10) * 2) t = -1.3766, df = 14.103, p-value = 0.1901 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.9403446 0.2048443 sample estimates: mean of x mean of y Thank you in advance for your help. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] argument order for Math2 group functions in R 2.6.x (PR#10679)
You could always define your own signif() as signif <- function(x, digits = 6){ base::signif(x, digits) } I do something like this for signif() and round() because economists don't like the round-to-even convention R uses. My round() function, for example, is: round <- function(x, digits = 0, round.to.even = FALSE){ ## Fixed to always round 0.5 to 1. The S "round to even" convention ## can be switched on via the round.to.even argument. -- JJH xclass <- class(x) if(is.matrix(x)){ digits <- rep(digits, length=ncol(x)) for(j in 1:ncol(x)) x[,j] <- round(x[,j], digits = digits[j], round.to.even = round.to.even) } else { if(round.to.even) return(base::round(x, digits)) ten.to.digits <- 10^digits x <- trunc((x * ten.to.digits) + (sign(x[]) * 0.5))/ten.to.digits } class(x) <- xclass return(x) } Sure, it's a lot slower. It still saves me several hours a year from not having to explain what round-to-even does, and why my users should learn to like it. They violently object to the idea that 1 + round(1.5) != round(1 + 1.5) -- Jeff __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] R valgrind question
> Various blocks of memory are not freed until the program is shut down, but > are in use up to that point so it is not a 'leak'. Most of the warnings > are not from R itself but from e.g. readline or X11, and all are tiny. That makes sense, thank you for clarifying. best regards, daniel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] (PR#10696) maybe a bug in the system.time() function?
Alessandra Iacobucci wrote: > > On Feb 4, 2008, at 7:22 PM, Hin-Tak Leung wrote: > >> You will get yelled at by others for posting a question as a bug... >> (sigh). See FAQ. > > I am a non-member so my message should normally pass through a moderator. Your understanding is again wrong - AFAIK, R-devel/R-user don't moderate against mon-members - *and* the point of the FAQ is that it *wastes* core R member's time to clear up non-bugs on the bug tracking system, so you are wrong on 3 counts there (wrong for posting non-bugs as bug reports, wrong for assuming that non-bug reports are moderated, and wrong to assume that moderator/R-core member's time are not valuable). A simple question like yours to R-devel/R-user can be answered by non-R-core people who is experienced in R, and more of them, that's the difference. Please read the FAQ, and read the spirit behind it as well. >> That said, your understanding of the output of system.time() is wrong. >> The value you are after is simply user+system. %CPU is essentially >> user+system/elapsed. It is elapsed which is dependent on system >> load, not the other two (usually). > > Usually. By running a given simulation I got > > usersystem elapsed > 6.161 0.066 6.608 > > By running the same exact simulation (same set of parameters, same > seeds, same everything) and running contemporaneously other two > processes this is what I got > > 7.515 0.084 11.062 > > As you can see, and this is what it strikes me and push me to that > wretched action, it is not only the elapsed time that depends on %CPU. I > would have expected the same value for user or system time. > >> >> Back into replying more in the usual R-devel sarcastic style... if you >> don't understand what user/system/elapsed means, you really have no >> place studying CPU loads... > > I surely have no place in studying CPU loads. Now, could you tell me why > I do not get the same values? > > Is it possible to get or how could one calculate just the amount of time > that the machine spends in doing just this simulation and nothing else, > without asking the entire department not to use it? > > Thanks in advance for you answer. First, for something like <10 sec you are going to have uncertainty from the garbage collection, and the granularity of sampling - you need to time something that's a bit longer to get out of both of these; 2nd, you never mention anything about your machine/architecture of your Mac OS X box. Your system is probably running on multi-core CPUs, which looks like more than 1 CPU from some applications, but certain kind of applications do interfere with each other on multi-core CPUs (it is really just one pretending to be two), and there is not much you can do about it, other than, as you said, ask others not to use it. >> [EMAIL PROTECTED] wrote: >>> Full_Name: Alessandra Iacobucci >>> Version: 2.5.1 >>> OS: Mac OS X 10.4.11 >>> Submission from: (NULL) (193.48.71.92) >>> Hi, >>> I am making some intensive simulations for the testing of a >>> Population Monte >>> Carlo algorithm. This involves also a study of the CPU times in two >>> different >>> case. >>> What I am trying to measure is the "real" CPU time, the one which is >>> independent >>> on the %CPU. I'm using the "system.time" function with gcFirst=TRUE >>> and I realized that all >>> of the output values (user, system and elapsed) depend on the >>> percentage of the >>> CPU, meaning that if your program is the only one running on the >>> machine, >>> system.time() gives you certain values, and if there are many >>> programs running >>> at the same time, for the exact same simulation system.time() gives >>> you much >>> higher values. >>> Thanks for you answer. >>> Best regards, >>> Alessandra Iacobucci >>> __ >>> 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] codetools::checkUsage should ignore expression in Quote(expr) (PR#10719)
Full_Name: Bill Dunlap Version: R version 2.7.0 Under development (unstable) (2008-02-05 r44340) OS: Linux Submission from: (NULL) (76.28.245.14) codetools::checkUsage() should treat the Quote() function just as it does the quote() and expression() functions: by ignoring its argument. Currently 'R CMD check pkg' complains if pkg's R code calls Quote(unknownName) but is quiet about quote(unknownName). quote() and Quote() are identical, but Quote is provided for compatibility with Splus (and version 4 of S). I would expect all the following to make no complaints. > codetools::checkUsage(function(x=Quote(hello(world)))x) : no visible global function definition for 'hello' : no visible binding for global variable 'world' > codetools::checkUsage(function(x=quote(hello(world)))x) > codetools::checkUsage(function(x=expression(hello(world)))x) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Building R for Windows
I have some C code (using an old Borland compiler) that calls a DLL that I'd like to get working from Windows and R (so I can read ABF files -- Axon Binary Files -- directly in R). I thought a good first approach would be able to build R in Windows, so that's what I'm trying to do. [I've done test builds of R under Linux before, and that seemed fairly simple.] I've tried to follow the instructions "Building R for Windows" from here: http://www.murdoch-sutherland.com/Rtools/ I installed Rtools27.exe and the other tools suggested here: http://www.murdoch-sutherland.com/Rtools/Rtools.txt I followed the instructions in first Rtools link "Obtaining the R source code" and have a directory with the latest C:\R\R-2-6-1. Should the "Building R for Windows" document say something about what should be done next? Section 2.1 Simple compilation http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset says: ./configure make These two statements work find on Linux, but I must be missing something under Windows XP Pro? Any suggestions? Also, what changes must be made to build R on a 64-bit Windows box? Do R Tools work for a 64-bit environment? Thanks for any help on this. Earl F. Glynn Bioinformatics Stowers Institute for Medical Research __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Building R for Windows
On 06/02/2008 6:46 PM, Earl F. Glynn wrote: > I have some C code (using an old Borland compiler) that calls a DLL that > I'd like to get working from Windows and R (so I can read ABF files -- Axon > Binary Files -- directly in R). > > I thought a good first approach would be able to build R in Windows, so > that's what I'm trying to do. [I've done test builds of R under Linux > before, and that seemed fairly simple.] > > I've tried to follow the instructions "Building R for Windows" from here: > http://www.murdoch-sutherland.com/Rtools/ > > I installed Rtools27.exe and the other tools suggested here: > http://www.murdoch-sutherland.com/Rtools/Rtools.txt > > I followed the instructions in first Rtools link "Obtaining the R source > code" and have a directory with the latest C:\R\R-2-6-1. > > Should the "Building R for Windows" document say something about what should > be done next? > > Section 2.1 Simple compilation > http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset > says: > > ./configure > make > > These two statements work find on Linux, but I must be missing something > under Windows XP Pro? Any suggestions? Those are Unix instructions. You want to follow the Windows instructions, in section 3.1.2 of that document: > Open a command window at R_HOME/src/gnuwin32. Edit MkRules to set the > appropriate paths as needed and to set the type(s) of help that you want > built. Beware: MkRules contains tabs and some editors (e.g., WinEdt) silently > remove them. Then run > > make all recommended > > and sit back and wait while the basic compile takes place. Duncan Murdoch > > Also, what changes must be made to build R on a 64-bit Windows box? Do R > Tools work for a 64-bit environment? > > Thanks for any help on this. > > Earl F. Glynn > Bioinformatics > Stowers Institute for Medical Research > > __ > 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