[Rd] Interpretting R profiling output (was More efficient code?)

2005-07-08 Thread Gavin Simpson
On Wed, 2005-07-06 at 19:54 +0100, Gavin Simpson wrote:
> Dear List,
> 

I fixed up the code in coinertiaI to only return the bits I needed from
La.svd() within the permutations - thus producing a 10% speed up. I am
still a little unclear about the results from Rprof() (below).

Do the timings under self time for .Call and .Fortran include the time
spent actually running the called compiled code or are they the overhead
of setting up the calls to the compiled code?

Many thanks,

Gav

> 
> summaryRprof(filename = "Rprof.out")
> $by.self
>  self.time self.pct total.time total.pct
> ".Call"  50.40 59.6  50.40  59.6
> "%*%"10.50 12.4  10.50  12.4
> ".Fortran"2.78  3.3   2.78   3.3
> "La.svd"  2.52  3.0  57.98  68.6
> "^"   2.48  2.9   2.48   2.9
> "t.default"   2.30  2.7   2.30   2.7
> "matrix"  1.92  2.3   1.98   2.3
> "as.double"   1.78  2.1   2.70   3.2
> "list"0.88  1.0   0.88   1.0
> "as.double.default"   0.86  1.0   0.86   1.0
> "rep.default" 0.74  0.9   0.86   1.0
> "sum" 0.72  0.9   2.58   3.1
> "!"   0.50  0.6   0.50   0.6
> "diag"0.44  0.5   1.46   1.7
> "qr.coef" 0.42  0.5   6.26   7.4
> "permtest"0.38  0.4  83.60  98.9
> "is.finite"   0.38  0.4   0.38   0.4
> "storage.mode<-"  0.36  0.4   3.26   3.9
> "as.integer"  0.34  0.4   0.40   0.5
> "t"   0.32  0.4   2.62   3.1
> "$"   0.32  0.4   0.32   0.4
> "paste"   0.28  0.3   0.54   0.6
> "teststat"0.24  0.3  83.10  98.3
> "residualMatrix"  0.22  0.3  10.32  12.2
> "qr"  0.20  0.2   1.24   1.5
> ...
> 
> $by.total
>  total.time total.pct self.time self.pct
> "predcoca.perm"   84.50 100.0  0.00  0.0
> "permtest"83.60  98.9  0.38  0.4
> "teststat"83.10  98.3  0.24  0.3
> "coinertiaI"  73.24  86.7  0.18  0.2
> "La.svd"  57.98  68.6  2.52  3.0
> ".Call"   50.40  59.6 50.40 59.6
> "%*%" 10.50  12.4 10.50 12.4
> "residualMatrix"  10.32  12.2  0.22  0.3
> "qr.coef"  6.26   7.4  0.42  0.5
> "storage.mode<-"   3.26   3.9  0.36  0.4
> ".Fortran" 2.78   3.3  2.78  3.3
> "as.double"2.70   3.2  1.78  2.1
> "t"2.62   3.1  0.32  0.4
> "eval" 2.62   3.1  0.14  0.2
> "sum"  2.58   3.1  0.72  0.9
> ...
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Interpretting R profiling output (was More efficient code?)

2005-07-08 Thread Duncan Murdoch
Gavin Simpson wrote:
> On Wed, 2005-07-06 at 19:54 +0100, Gavin Simpson wrote:
> 
>>Dear List,
>>
> 
> 
> I fixed up the code in coinertiaI to only return the bits I needed from
> La.svd() within the permutations - thus producing a 10% speed up. I am
> still a little unclear about the results from Rprof() (below).
> 
> Do the timings under self time for .Call and .Fortran include the time
> spent actually running the called compiled code or are they the overhead
> of setting up the calls to the compiled code?

They include both.  The profiler only sees R calls, it doesn't know what 
goes on within functions.  .Call() is an R call which internally calls 
some C function, but the profiler just sees the call to .Call.

Duncan Murdoch
> 
> Many thanks,
> 
> Gav
> 
> 
>>summaryRprof(filename = "Rprof.out")
>>$by.self
>> self.time self.pct total.time total.pct
>>".Call"  50.40 59.6  50.40  59.6
>>"%*%"10.50 12.4  10.50  12.4
>>".Fortran"2.78  3.3   2.78   3.3
>>"La.svd"  2.52  3.0  57.98  68.6
>>"^"   2.48  2.9   2.48   2.9
>>"t.default"   2.30  2.7   2.30   2.7
>>"matrix"  1.92  2.3   1.98   2.3
>>"as.double"   1.78  2.1   2.70   3.2
>>"list"0.88  1.0   0.88   1.0
>>"as.double.default"   0.86  1.0   0.86   1.0
>>"rep.default" 0.74  0.9   0.86   1.0
>>"sum" 0.72  0.9   2.58   3.1
>>"!"   0.50  0.6   0.50   0.6
>>"diag"0.44  0.5   1.46   1.7
>>"qr.coef" 0.42  0.5   6.26   7.4
>>"permtest"0.38  0.4  83.60  98.9
>>"is.finite"   0.38  0.4   0.38   0.4
>>"storage.mode<-"  0.36  0.4   3.26   3.9
>>"as.integer"  0.34  0.4   0.40   0.5
>>"t"   0.32  0.4   2.62   3.1
>>"$"   0.32  0.4   0.32   0.4
>>"paste"   0.28  0.3   0.54   0.6
>>"teststat"0.24  0.3  83.10  98.3
>>"residualMatrix"  0.22  0.3  10.32  12.2
>>"qr"  0.20  0.2   1.24   1.5
>>...
>>
>>$by.total
>> total.time total.pct self.time self.pct
>>"predcoca.perm"   84.50 100.0  0.00  0.0
>>"permtest"83.60  98.9  0.38  0.4
>>"teststat"83.10  98.3  0.24  0.3
>>"coinertiaI"  73.24  86.7  0.18  0.2
>>"La.svd"  57.98  68.6  2.52  3.0
>>".Call"   50.40  59.6 50.40 59.6
>>"%*%" 10.50  12.4 10.50 12.4
>>"residualMatrix"  10.32  12.2  0.22  0.3
>>"qr.coef"  6.26   7.4  0.42  0.5
>>"storage.mode<-"   3.26   3.9  0.36  0.4
>>".Fortran" 2.78   3.3  2.78  3.3
>>"as.double"2.70   3.2  1.78  2.1
>>"t"2.62   3.1  0.32  0.4
>>"eval" 2.62   3.1  0.14  0.2
>>"sum"  2.58   3.1  0.72  0.9
>>...
>>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] axTicks on a reverse ylog plot (PR#7973)

2005-07-08 Thread ligges
Here we go:

the quick fix is really easy, just sorting stuff in axTicks() 
(.../src/library/graphics/R/axis.R, diff'ed against R-release) is 
sufficient:


--- axis.R
+++ axis-fix.R
@@ -29,7 +29,8 @@
  stop("invalid positive 'axp[3]'")
  if(is.null(usr)) usr <- par("usr")[if(is.x) 1:2 else 3:4]
  else if(!is.numeric(usr) || length(usr) != 2) stop("invalid 
'usr'")
-ii <- round(log10(axp[1:2]))
+ii <- round(log10(sort(axp[1:2])))
+usr <- sort(usr)
  x10 <- 10^((ii[1] - (iC >= 2)):ii[2])
  r <- switch(iC, ## axp[3]
  x10,## 1



BTW: In your R code below, you have to use (as documented)
   grid(equilogs = FALSE)


We might want to consider to change axTicks anyway:
We could return values from the internal axis() calculations
and therefore replace axTicks calculations by stuff that is much more 
reliable. Opinions?

The current equilogs default argument setting is inconvinient anyway,
because it does not fit with the current device setting for real axis 
ticks  (which can also be done in R, of course).

Uwe Ligges





[EMAIL PROTECTED] wrote:

> There is still issues with the reversed y-log scale plot:
> 
> # Test case A: works as expected
> plot(10:100,log="y",ylim=c(100,11))
> grid()
> par("yaxp")
> 
> # Test case B: grid does not have horizontal lines; par("yaxp") is  
> different
> plot(1:100,log="y",ylim=c(100,10))
> grid()
> par("yaxp")
> 
> In the second test case, axTicks for the horizontal lines (in grid())  
> returns numeric(0) for spacing ... how do the tick marks get drawn in  
> the first place??
> -mt
> 
> --please do not edit the information below--
> 
> Version:
> platform = powerpc-apple-darwin8.1.0
> arch = powerpc
> os = darwin8.1.0
> system = powerpc, darwin8.1.0
> status = Patched
> major = 2
> minor = 1.1
> year = 2005
> month = 06
> day = 26
> language = R
> 
> Locale:
> en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics,  
> package:grDevices, package:utils, package:datasets, Autoloads,  
> package:base
> 
> __
> 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] Error message using Packages | Install | Cancel

2005-07-08 Thread Gabor Grothendieck
If we click on the Cancel button after the Packages | Install menu items in 
Windows 2.1.1 (dated 2005-06-23) it gives an error message.   There
really should
be no error here since we intended not to install anything -- that is why
we pressed Cancel.  This is what appears on the console:

> utils:::menuInstallPkgs()
Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE,
type = type) :
no packages were specified

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Sweave resource leak: leftover temp files (PR#7998)

2005-07-08 Thread murdoch
Harold, I've taken a closer look at your example and I'd call this an 
Sweave bug.  It creates tempfiles each time you run it, and doesn't 
delete them at the end.  For example:

 > list.files(tempdir())
character(0)
 > testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package = "utils")
 > Sweave(testfile, out="junk.tex")
Writing to file junk.tex
Processing code chunks ...
  1 : print term verbatim
  2 : term hide
  3 : echo print term verbatim
  4 : term verbatim
  5 : echo term verbatim
  6 : echo term verbatim eps pdf
  7 : echo term verbatim eps pdf

You can now run LaTeX on 'junk.tex'
 > list.files(tempdir())
  [1] "Rf10523" "Rf13872" "Rf17129" "Rf2055"  "Rf2203"  "Rf2403"  "Rf27095"
  [8] "Rf2892"  "Rf31415" "Rf5290"  "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"
 > Sweave(testfile, out="C:/temp/junk.tex")
Writing to file C:/temp/junk.tex
Processing code chunks ...
  1 : print term verbatim
  2 : term hide
  3 : echo print term verbatim
  4 : term verbatim
  5 : echo term verbatim
  6 : echo term verbatim eps pdf
  7 : echo term verbatim eps pdf

You can now run LaTeX on 'C:/temp/junk.tex'
 > list.files(tempdir())
  [1] "Rf10523" "Rf12679" "Rf1311"  "Rf13484" "Rf13872" "Rf17129" "Rf17288"
  [8] "Rf2055"  "Rf21774" "Rf2203"  "Rf23417" "Rf2403"  "Rf27095" "Rf2892"
[15] "Rf29444" "Rf31128" "Rf31415" "Rf32520" "Rf3338"  "Rf5290"  "Rf5551"
[22] "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"   "Rf7543"  "Rf758"   "Rf7673"
 > unlink(list.files(tempdir(),full=T))
 > list.files(tempdir())
character(0)

Harold:  a workaround for this would be to wrap your Sweave call in 
something like this:

keep <- list.files(tempdir(), full=TRUE)  # keep previous temp files

... Call Sweave here ...

temps <- list.files(tempdir(), full=TRUE)
unlink(temps[!(temps %in% keep)])  # delete the newly created ones

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Sweave resource leak: leftover temp files (PR#7999)

2005-07-08 Thread HDoran
This is great. Thank you for your help, but let me make sure I fully
understand. Here is the looping file I use to subset the data frame,
create a tex file, and Sweave it. This results in N number of tex files
where N is equal to the number of rows in the data frame.

list <- unique(wide$stuid)
master = "master.tex"
for (i in list){
 tmp1 <- subset(wide, stuid==i)
 tmp2 <- paste(i, "tex", sep=".")
 Sweave("fam_template.Rnw", output=tmp2)
 file.append("fam_master.tex", tmp2) 
}

If I follow correctly, I would need to place these commands inside the
loop as follows: 

list <- unique(wide$stuid)
master = "master.tex"
for (i in list){
 tmp1 <- subset(wide, stuid==i)
 tmp2 <- paste(i, "tex", sep=".")
 keep <- list.files(tempdir(), full=TRUE)  # keep previous temp
files
 Sweave("fam_template.Rnw", output=tmp2)
 file.append("fam_master.tex", tmp2)
 temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
keep)])  # delete the newly created ones 
}


Thank you for taking the time to look at this.

Harold

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 08, 2005 9:28 AM
To: Duncan Murdoch
Cc: Doran, Harold; [EMAIL PROTECTED]; Uwe Ligges; Sean O'Riordain
Subject: Sweave resource leak: leftover temp files

Harold, I've taken a closer look at your example and I'd call this an
Sweave bug.  It creates tempfiles each time you run it, and doesn't
delete them at the end.  For example:

 > list.files(tempdir())
character(0)
 > testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package =
"utils")  > Sweave(testfile, out="junk.tex") Writing to file junk.tex
Processing code chunks ...
  1 : print term verbatim
  2 : term hide
  3 : echo print term verbatim
  4 : term verbatim
  5 : echo term verbatim
  6 : echo term verbatim eps pdf
  7 : echo term verbatim eps pdf

You can now run LaTeX on 'junk.tex'
 > list.files(tempdir())
  [1] "Rf10523" "Rf13872" "Rf17129" "Rf2055"  "Rf2203"  "Rf2403"
"Rf27095"
  [8] "Rf2892"  "Rf31415" "Rf5290"  "Rf6251"  "Rf6482"  "Rf7055"
"Rf724"
 > Sweave(testfile, out="C:/temp/junk.tex") Writing to file
C:/temp/junk.tex Processing code chunks ...
  1 : print term verbatim
  2 : term hide
  3 : echo print term verbatim
  4 : term verbatim
  5 : echo term verbatim
  6 : echo term verbatim eps pdf
  7 : echo term verbatim eps pdf

You can now run LaTeX on 'C:/temp/junk.tex'
 > list.files(tempdir())
  [1] "Rf10523" "Rf12679" "Rf1311"  "Rf13484" "Rf13872" "Rf17129"
"Rf17288"
  [8] "Rf2055"  "Rf21774" "Rf2203"  "Rf23417" "Rf2403"  "Rf27095"
"Rf2892"
[15] "Rf29444" "Rf31128" "Rf31415" "Rf32520" "Rf3338"  "Rf5290"
"Rf5551"
[22] "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"   "Rf7543"  "Rf758"
"Rf7673"
 > unlink(list.files(tempdir(),full=T))
 > list.files(tempdir())
character(0)

Harold:  a workaround for this would be to wrap your Sweave call in
something like this:

keep <- list.files(tempdir(), full=TRUE)  # keep previous temp files

... Call Sweave here ...

temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
keep)])  # delete the newly created ones

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Sweave resource leak: leftover temp files

2005-07-08 Thread Duncan Murdoch
On 7/8/2005 9:36 AM, Doran, Harold wrote:
> This is great. Thank you for your help, but let me make sure I fully
> understand. Here is the looping file I use to subset the data frame,
> create a tex file, and Sweave it. This results in N number of tex files
> where N is equal to the number of rows in the data frame.
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2) 
> }
> 
> If I follow correctly, I would need to place these commands inside the
> loop as follows: 
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  keep <- list.files(tempdir(), full=TRUE)  # keep previous temp
> files
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2)
>  temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
> keep)])  # delete the newly created ones 
> }

There's a wordwrapping error there:  the temps <- list.files(...) and 
unlink(temps...) should be on separate lines.

I'd also put them immediately after the Sweave call, but they should be 
fine where you have them.  (The advantage of putting them immediately 
after Sweave is that you don't need to think about the next line.  If it 
created a temp file and you wanted to keep it, you'd need the extra 
lines first.  But it doesn't, so it doesn't really matter.)

Duncan Murdoch
> 
> 
> Thank you for taking the time to look at this.
> 
> Harold
> 
> -Original Message-
> From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
> Sent: Friday, July 08, 2005 9:28 AM
> To: Duncan Murdoch
> Cc: Doran, Harold; [EMAIL PROTECTED]; Uwe Ligges; Sean O'Riordain
> Subject: Sweave resource leak: leftover temp files
> 
> Harold, I've taken a closer look at your example and I'd call this an
> Sweave bug.  It creates tempfiles each time you run it, and doesn't
> delete them at the end.  For example:
> 
>  > list.files(tempdir())
> character(0)
>  > testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package =
> "utils")  > Sweave(testfile, out="junk.tex") Writing to file junk.tex
> Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf13872" "Rf17129" "Rf2055"  "Rf2203"  "Rf2403"
> "Rf27095"
>   [8] "Rf2892"  "Rf31415" "Rf5290"  "Rf6251"  "Rf6482"  "Rf7055"
> "Rf724"
>  > Sweave(testfile, out="C:/temp/junk.tex") Writing to file
> C:/temp/junk.tex Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'C:/temp/junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf12679" "Rf1311"  "Rf13484" "Rf13872" "Rf17129"
> "Rf17288"
>   [8] "Rf2055"  "Rf21774" "Rf2203"  "Rf23417" "Rf2403"  "Rf27095"
> "Rf2892"
> [15] "Rf29444" "Rf31128" "Rf31415" "Rf32520" "Rf3338"  "Rf5290"
> "Rf5551"
> [22] "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"   "Rf7543"  "Rf758"
> "Rf7673"
>  > unlink(list.files(tempdir(),full=T))
>  > list.files(tempdir())
> character(0)
> 
> Harold:  a workaround for this would be to wrap your Sweave call in
> something like this:
> 
> keep <- list.files(tempdir(), full=TRUE)  # keep previous temp files
> 
> ... Call Sweave here ...
> 
> temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
> keep)])  # delete the newly created ones
> 
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Sweave resource leak: leftover temp files (PR#7999)

2005-07-08 Thread Duncan Murdoch
One additional note:  followups should only go to R-bugs if they have 
the bug number on them (like this message does).  Otherwise you end up 
generating a separate bug report (PR#7999 was created in your reply to 
my submission of PR#7998).  Usually it's best just to cc R-devel, unless 
you really have additional information to add to the bug report.

We're planning (or in the process of?) changing the bug reporting 
system, so this is only a temporary inconvenience.

Duncan Murdoch

On 7/8/2005 9:36 AM, [EMAIL PROTECTED] wrote:
> This is great. Thank you for your help, but let me make sure I fully
> understand. Here is the looping file I use to subset the data frame,
> create a tex file, and Sweave it. This results in N number of tex files
> where N is equal to the number of rows in the data frame.
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2) 
> }
> 
> If I follow correctly, I would need to place these commands inside the
> loop as follows: 
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  keep <- list.files(tempdir(), full=TRUE)  # keep previous temp
> files
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2)
>  temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
> keep)])  # delete the newly created ones 
> }
> 
> 
> Thank you for taking the time to look at this.
> 
> Harold
> 
> -Original Message-
> From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
> Sent: Friday, July 08, 2005 9:28 AM
> To: Duncan Murdoch
> Cc: Doran, Harold; [EMAIL PROTECTED]; Uwe Ligges; Sean O'Riordain
> Subject: Sweave resource leak: leftover temp files
> 
> Harold, I've taken a closer look at your example and I'd call this an
> Sweave bug.  It creates tempfiles each time you run it, and doesn't
> delete them at the end.  For example:
> 
>  > list.files(tempdir())
> character(0)
>  > testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package =
> "utils")  > Sweave(testfile, out="junk.tex") Writing to file junk.tex
> Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf13872" "Rf17129" "Rf2055"  "Rf2203"  "Rf2403"
> "Rf27095"
>   [8] "Rf2892"  "Rf31415" "Rf5290"  "Rf6251"  "Rf6482"  "Rf7055"
> "Rf724"
>  > Sweave(testfile, out="C:/temp/junk.tex") Writing to file
> C:/temp/junk.tex Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'C:/temp/junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf12679" "Rf1311"  "Rf13484" "Rf13872" "Rf17129"
> "Rf17288"
>   [8] "Rf2055"  "Rf21774" "Rf2203"  "Rf23417" "Rf2403"  "Rf27095"
> "Rf2892"
> [15] "Rf29444" "Rf31128" "Rf31415" "Rf32520" "Rf3338"  "Rf5290"
> "Rf5551"
> [22] "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"   "Rf7543"  "Rf758"
> "Rf7673"
>  > unlink(list.files(tempdir(),full=T))
>  > list.files(tempdir())
> character(0)
> 
> Harold:  a workaround for this would be to wrap your Sweave call in
> something like this:
> 
> keep <- list.files(tempdir(), full=TRUE)  # keep previous temp files
> 
> ... Call Sweave here ...
> 
> temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
> keep)])  # delete the newly created ones
> 
> __
> 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] Sweave resource leak: leftover temp files (PR#7999)

2005-07-08 Thread Gabor Grothendieck
On 7/8/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote:

> We're planning (or in the process of?) changing the bug reporting
> system, so this is only a temporary inconvenience.
> 

I think these points have been raised before but, just in case, some
aspects of this, if its changing anyways, that would be nice to see
would be:

- integration with svn
- expansion from bug tracking to issue, change and wishlist tracking

Also it would be nice to have a consistent standard way to:

- track issues, changes and wishlists in individual packages, not just in R

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R] pairs() uses col argument for axes coloring

2005-07-08 Thread Duncan Murdoch
On 7/8/2005 8:52 AM, Olaf Mersmann wrote:
> Hi Duncan,
> 
> On 7/8/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> Olaf Mersmann wrote:
> *snip*
>> > Looking at the source for pairs() suggests, that this is the case
>> > because col is part of the ... argument list which is passed on to
>> > localAxis (and from there to axis). Wouldn't it be more approptiate to
>> > use the same color box() uses to draw the border around each
>> > scatterplot? If yes, should I open a bug for this or how would such a
>> > feature request be handled?
>> 
>> The best way is to get the source to pairs() (from the SVN repository
>> in https://svn.r-project.org/R/trunk/src/library/graphics/R/pairs.R not
>> from looking at it in R), work out what changes are needed, and submit
>> them as a patch.  You can post the patch in the R-bugs list, or just
>> send it to me.   Thanks!
> 
> I attached my patch to pairs.R to fix the problem. They way I 'solved'
> the issue is by simply ignoring any col argument that is passed to
> localAxis and from there to axis. At first I had thought about adding
> col explicitly to the argument list of pairs() and then only passing
> it on to the panel functions, but that would possibly break existing
> code (for example the example panel.cor() in the pairs() man page).

I like your fix.  It makes pairs() act like plot() in its treatment of 
col and col.axis parameters.

I do find the col.axis treatment a little weird (affecting the labels, 
but not the axis), but that's a different issue.

I'll commit your patch to R-devel and R-patched.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Sweave resource leak: leftover temp files (PR#7999)

2005-07-08 Thread Peter Dalgaard
Gabor Grothendieck <[EMAIL PROTECTED]> writes:

> On 7/8/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> 
> > We're planning (or in the process of?) changing the bug reporting
> > system, so this is only a temporary inconvenience.
> > 
> 
> I think these points have been raised before but, just in case, some
> aspects of this, if its changing anyways, that would be nice to see
> would be:
> 
> - integration with svn
> - expansion from bug tracking to issue, change and wishlist tracking
> 
> Also it would be nice to have a consistent standard way to:
> 
> - track issues, changes and wishlists in individual packages, not just in R

Well, since I'm going on vacation as of *now*, it's not going to
happen until August...

Re. the last point, it does require that package maintainers play
along. They have not been very good at closing issues in the Add-on
section of the current bug repo, which is why we currently recommend
users to approach the maintainer directly.

As a general matter, nobody is going to do bug repository maintenance
as a full-time job, so we need to go with a turnkey solution like
Bugzilla. We're likely going to lose the mailing list integration as
we know it -- we can probably send a copy of all bug reports to
r-devel, but there's not going to be a nice way to save the followups
automagically. Users will also likely be requested to obtain a
password and login before submitting a bug.

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message using Packages | Install | Cancel

2005-07-08 Thread Duncan Murdoch
On 7/8/2005 8:56 AM, Gabor Grothendieck wrote:
> If we click on the Cancel button after the Packages | Install menu items in 
> Windows 2.1.1 (dated 2005-06-23) it gives an error message.   There
> really should
> be no error here since we intended not to install anything -- that is why
> we pressed Cancel.  This is what appears on the console:
> 
>> utils:::menuInstallPkgs()
> Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE,
> type = type) :
> no packages were specified

I'd consider a patch to fix this, but it doesn't look serious enough to 
make it onto my list of things to do myself.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Sweave resource leak: leftover temp files (PR#7999)

2005-07-08 Thread Doran, Harold
Duncan and d-level

Your proposed solution works well and seems to resolve the issue. I
previously noted to you that it seemed to run slower, but this is not
true. I restarted R and it is equally as fast. Thank you for your
attention to this matter.

-Harold

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 08, 2005 10:10 AM
To: Doran, Harold
Cc: r-devel@stat.math.ethz.ch
Subject: Re: [Rd] Sweave resource leak: leftover temp files (PR#7999)

One additional note:  followups should only go to R-bugs if they have
the bug number on them (like this message does).  Otherwise you end up
generating a separate bug report (PR#7999 was created in your reply to
my submission of PR#7998).  Usually it's best just to cc R-devel, unless
you really have additional information to add to the bug report.

We're planning (or in the process of?) changing the bug reporting
system, so this is only a temporary inconvenience.

Duncan Murdoch

On 7/8/2005 9:36 AM, [EMAIL PROTECTED] wrote:
> This is great. Thank you for your help, but let me make sure I fully 
> understand. Here is the looping file I use to subset the data frame, 
> create a tex file, and Sweave it. This results in N number of tex 
> files where N is equal to the number of rows in the data frame.
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2) }
> 
> If I follow correctly, I would need to place these commands inside the

> loop as follows:
> 
> list <- unique(wide$stuid)
> master = "master.tex"
> for (i in list){
>  tmp1 <- subset(wide, stuid==i)
>  tmp2 <- paste(i, "tex", sep=".")
>  keep <- list.files(tempdir(), full=TRUE)  # keep previous temp 
> files
>  Sweave("fam_template.Rnw", output=tmp2)
>  file.append("fam_master.tex", tmp2)
>  temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps 
> %in%
> keep)])  # delete the newly created ones }
> 
> 
> Thank you for taking the time to look at this.
> 
> Harold
> 
> -Original Message-
> From: Duncan Murdoch [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 08, 2005 9:28 AM
> To: Duncan Murdoch
> Cc: Doran, Harold; [EMAIL PROTECTED]; Uwe Ligges; Sean O'Riordain
> Subject: Sweave resource leak: leftover temp files
> 
> Harold, I've taken a closer look at your example and I'd call this an 
> Sweave bug.  It creates tempfiles each time you run it, and doesn't 
> delete them at the end.  For example:
> 
>  > list.files(tempdir())
> character(0)
>  > testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package =
> "utils")  > Sweave(testfile, out="junk.tex") Writing to file junk.tex 
> Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf13872" "Rf17129" "Rf2055"  "Rf2203"  "Rf2403"
> "Rf27095"
>   [8] "Rf2892"  "Rf31415" "Rf5290"  "Rf6251"  "Rf6482"  "Rf7055"
> "Rf724"
>  > Sweave(testfile, out="C:/temp/junk.tex") Writing to file 
> C:/temp/junk.tex Processing code chunks ...
>   1 : print term verbatim
>   2 : term hide
>   3 : echo print term verbatim
>   4 : term verbatim
>   5 : echo term verbatim
>   6 : echo term verbatim eps pdf
>   7 : echo term verbatim eps pdf
> 
> You can now run LaTeX on 'C:/temp/junk.tex'
>  > list.files(tempdir())
>   [1] "Rf10523" "Rf12679" "Rf1311"  "Rf13484" "Rf13872" "Rf17129"
> "Rf17288"
>   [8] "Rf2055"  "Rf21774" "Rf2203"  "Rf23417" "Rf2403"  "Rf27095"
> "Rf2892"
> [15] "Rf29444" "Rf31128" "Rf31415" "Rf32520" "Rf3338"  "Rf5290"
> "Rf5551"
> [22] "Rf6251"  "Rf6482"  "Rf7055"  "Rf724"   "Rf7543"  "Rf758"
> "Rf7673"
>  > unlink(list.files(tempdir(),full=T))
>  > list.files(tempdir())
> character(0)
> 
> Harold:  a workaround for this would be to wrap your Sweave call in 
> something like this:
> 
> keep <- list.files(tempdir(), full=TRUE)  # keep previous temp files
> 
> ... Call Sweave here ...
> 
> temps <- list.files(tempdir(), full=TRUE) unlink(temps[!(temps %in%
> keep)])  # delete the newly created ones
> 
> __
> 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] Error message using Packages | Install | Cancel

2005-07-08 Thread Gabor Grothendieck
On 7/8/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> On 7/8/2005 8:56 AM, Gabor Grothendieck wrote:
> > If we click on the Cancel button after the Packages | Install menu items in
> > Windows 2.1.1 (dated 2005-06-23) it gives an error message.   There
> > really should
> > be no error here since we intended not to install anything -- that is why
> > we pressed Cancel.  This is what appears on the console:
> >
> >> utils:::menuInstallPkgs()
> > Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE,
> > type = type) :
> > no packages were specified
> 
> I'd consider a patch to fix this, but it doesn't look serious enough to
> make it onto my list of things to do myself.
> 
> Duncan Murdoch
> 

Sure. I will file a bug report so it does not get lost.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Packages | Install >Cancel gives error msg in Windows GUI (PR#8000)

2005-07-08 Thread ggrothendieck
Full_Name: G. Grothendieck
Version: R version 2.1.1, 2005-06-23
OS: Windows XP
Submission from: (NULL) (216.59.244.202)



In the Windows GUI, choosing the Packages Menu, then Install and then 
clicking on Cancel gives an error message saying that nothing was specified
to be installed:

> utils:::menuInstallPkgs()
Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE, type =
type) : 
no packages were specified

however, its not erroneous -- we intended not to install anything.  That
is why we pressed Cancel.

This was discussed on r-devel.  See:

https://www.stat.math.ethz.ch/pipermail/r-devel/2005-July/033923.html

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] pgamma(Inf, 1.1, 1.1) (PR#8001)

2005-07-08 Thread ligges
The call of

pgamma(Inf, 1.1, 1.1)

does not finish on my machines within 5 minutes...
(both under Linux and Windows). Haven't looked in the sources yet.

Thanks to Dietrich Trenkler for bringing this up in a private discussion.

Uwe Ligges



--please do not edit the information below--

Version:
  platform = i386-pc-mingw32
  arch = i386
  os = mingw32
  system = i386, mingw32
  status =
  major = 2
  minor = 1.1
  year = 2005
  month = 06
  day = 20
  language = R

Windows NT 4.0 (build 1381) Service Pack 6

Locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

Search Path:
  .GlobalEnv, package:methods, package:stats, package:graphics, 
package:grDevices, package:datasets, package:utils, package:fortunes, 
Autoloads, package:base

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Packages | Install >Cancel gives error msg in Windows GUI (PR#8002)

2005-07-08 Thread murdoch
On 7/8/2005 11:46 AM, [EMAIL PROTECTED] wrote:
> Full_Name: G. Grothendieck
> Version: R version 2.1.1, 2005-06-23
> OS: Windows XP
> Submission from: (NULL) (216.59.244.202)
> 
> 
> 
> In the Windows GUI, choosing the Packages Menu, then Install and then 
> clicking on Cancel gives an error message saying that nothing was specified
> to be installed:
> 
>> utils:::menuInstallPkgs()
> Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE, type =
> type) : 
> no packages were specified
> 
> however, its not erroneous -- we intended not to install anything.  That
> is why we pressed Cancel.
> 
> This was discussed on r-devel.  See:
> 
> https://www.stat.math.ethz.ch/pipermail/r-devel/2005-July/033923.html

My conclusion there was that this error message should not be appearing, 
but it's not worth my time to fix.  I'll move this bug report to the 
wishlist.

If someone wants to submit a patch to fix it, I'll look at it.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Suggestion: Help users sort data frames

2005-07-08 Thread kwright

I've noticed that a frequently asked question on R-help is how to sort a
data frame by multiple columns.  Since this question is asked so often,
making this task easier for users seems a worthwhile goal.

At a minimum, the following changes to the documentation would surely be
helpful and reduce email postings to R-help:

1. In the "See Also" section of the help page for 'sort' it currently says:
"order for sorting on or reordering multiple variables".
Appending the phrase "(including data frames)" could be helpful.

2. Include a simple example on sorting a data frame in the 'sort' help. 
In an ideal world this example should belong in the help for 'order', but
people are going to be reading the 'sort' page first.  Here's one example:

# Sort a data frame by multiple columns
d = data.frame(b=factor(c("Hi","Med","Hi","Low"),levels=c("Low","Med","Hi"),
   ordered=TRUE),
   x=c("A","D","A","C"),y=c(8,3,9,9),z=c(1,1,1,2))
d[order(d$b,d$z,d$y),]

3. It looks like the help page for 'order' only shows sorting of matrices
(and row-wise sorting at that!).  Since column-wise sorting is may be more
common, the example above might beneficially be included in the 'order'
help page as well.

A minor bug-report here: The help for 'order' includes this example:
  ## For character vectors we can make use of rank:
  cy <- as.character(y)
  rbind(x,y,z)[, order(x, -rank(y), z)]
I'm not sure what the intention was, but 'cy' is not used, so something
seems to be amis.



Alternatively, I wrote a formula-based function for sorting data frames
via calls like: sort.data.frame(~ -x +y +z, dat)
The function can be found here:
  http://tolstoy.newcastle.edu.au/R/help/04/09/4300.html
When emails to R-help ask how to sort data frames, responses often
reference this function so it seems to have been very helpful for people. 
I showed the function to Thomas Lumley and he said it looked nice but that
using a minus sign for reverse sorting is a bit anti-R flavored since a
minus sign usually means to omit terms from a formula.


Sincerely,

Kevin Wright

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Suggestion: Help users sort data frames

2005-07-08 Thread Gabor Grothendieck
This functionality does seem needed in base R to me too but
in the interim you could create a package to make it available on 
CRAN or if that seems excessive for just one function you could 
contact the author of one of the multi-author packages and see if 
they would include it in their package.  

On 7/8/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 
> I've noticed that a frequently asked question on R-help is how to sort a
> data frame by multiple columns.  Since this question is asked so often,
> making this task easier for users seems a worthwhile goal.
> 
> At a minimum, the following changes to the documentation would surely be
> helpful and reduce email postings to R-help:
> 
> 1. In the "See Also" section of the help page for 'sort' it currently says:
> "order for sorting on or reordering multiple variables".
> Appending the phrase "(including data frames)" could be helpful.
> 
> 2. Include a simple example on sorting a data frame in the 'sort' help.
> In an ideal world this example should belong in the help for 'order', but
> people are going to be reading the 'sort' page first.  Here's one example:
> 
> # Sort a data frame by multiple columns
> d = data.frame(b=factor(c("Hi","Med","Hi","Low"),levels=c("Low","Med","Hi"),
>   ordered=TRUE),
>   x=c("A","D","A","C"),y=c(8,3,9,9),z=c(1,1,1,2))
> d[order(d$b,d$z,d$y),]
> 
> 3. It looks like the help page for 'order' only shows sorting of matrices
> (and row-wise sorting at that!).  Since column-wise sorting is may be more
> common, the example above might beneficially be included in the 'order'
> help page as well.
> 
> A minor bug-report here: The help for 'order' includes this example:
>  ## For character vectors we can make use of rank:
>  cy <- as.character(y)
>  rbind(x,y,z)[, order(x, -rank(y), z)]
> I'm not sure what the intention was, but 'cy' is not used, so something
> seems to be amis.
> 
> 
> 
> Alternatively, I wrote a formula-based function for sorting data frames
> via calls like: sort.data.frame(~ -x +y +z, dat)
> The function can be found here:
>  http://tolstoy.newcastle.edu.au/R/help/04/09/4300.html
> When emails to R-help ask how to sort data frames, responses often
> reference this function so it seems to have been very helpful for people.
> I showed the function to Thomas Lumley and he said it looked nice but that
> using a minus sign for reverse sorting is a bit anti-R flavored since a
> minus sign usually means to omit terms from a formula.
> 
> 
> Sincerely,
> 
> Kevin Wright
> 
> __
> 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