Re: [Rd] An example of very slow computation

2011-08-18 Thread Michael Lachmann
On my trials, after eliminating all the extra matrix-dgeMatrix conversions, using expm() and the method below were equally fast. Michael On 19 Aug 2011, at 1:32AM, Ravi Varadhan wrote: Which is why I said it applies when the system is diagonalizable. It won't work for non-diagonalizable

Re: [Rd] An example of very slow computation

2011-08-17 Thread Michael Lachmann
I think one difference is that negll() is fully vectorized - no loops, whereas nlogL calls the function sol() inside sapply, i.e. a loop. Michael On 17 Aug 2011, at 10:27AM, John C Nash wrote: This message is about a curious difference in timing between two ways of computing the same

Re: [Rd] An example of very slow computation

2011-08-17 Thread Michael Lachmann
On 17 Aug 2011, at 7:08PM, cbe...@tajo.ucsd.edu cbe...@tajo.ucsd.edu wrote: John C Nash nas...@uottawa.ca writes: This message is about a curious difference in timing between two ways of computing the same function. One uses expm, so is expected to be a bit slower, but a bit turned out

Re: [Rd] An example of very slow computation

2011-08-17 Thread Michael Lachmann
the 1.5 seconds change mentioned below. So, overall a ~40 fold improvement, though on my machine, the initial ratio was ~3200 times slower, so a ~80 fold slowdown is still present. Michael On 17 Aug 2011, at 11:27PM, Michael Lachmann wrote: On 17 Aug 2011, at 7:08PM, cbe...@tajo.ucsd.edu cbe

[Rd] fitted valued should mention predict

2011-08-16 Thread Michael Lachmann
Hi, I think the help on fitted.values and fitted should mention predict in the see also. (And maybe vice versa) Michael __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] gsub(\\, \\\\, C:\Program Files\R)

2011-08-12 Thread Michael Lachmann
Interesting question. It is really about how to avoid the interpretation of \ as an escape character in a string. I wonder if it is possible. Anyway, have you tried the following: setwd(readLines(clipboard,warn=F)) clipboard is a special filename that tells R to read from the clipboard.

Re: [Rd] slightly speeding up readChar()

2011-08-05 Thread Michael Lachmann
On 5 Aug 2011, at 1:20AM, Dirk Eddelbuettel wrote: When you know the (fixed) structure of the data, the CRAN package mmap can be a huge winner. Thanks! I didn't know that. Is there a package that provides methods for mmap, like sum(x) or maybe even y=x+z where x, and z are mmaps? I assume

[Rd] slightly speeding up readChar()

2011-08-04 Thread Michael Lachmann
Thanks for listening, Michael Lachmann __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] slightly speeding up readChar()

2011-08-04 Thread Michael Lachmann
On 4 Aug 2011, at 11:50PM, Simon Urbanek wrote: On Aug 4, 2011, at 5:26 PM, Michael Lachmann wrote: Hi, I was trying to have R read files faster with readChar(). That was before I noticed that readChar() is not that bad! In any case, below I suggest a few simple changes

[Rd] one way to solve bad looking density plots in postscript

2011-08-03 Thread Michael Lachmann
. But that is probably a change in the image() routine, not in the postscript driver Thanks for listening, Michael Lachmann __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] one way to solve bad looking density plots in postscript

2011-08-03 Thread Michael Lachmann
is drawn, before or after .Internal(image(as.double(x), as.double(y), as.integer(zi), col)) is called, the resulting eps has the box in front. Michael On 3 Aug 2011, at 9:25AM, Michael Lachmann wrote: When R generates density plots and these are exported to postscript( a=matrix(1

Re: [Rd] one way to solve bad looking density plots in postscript

2011-08-03 Thread Michael Lachmann
, baptiste On 4 August 2011 00:23, Michael Lachmann lachm...@eva.mpg.de wrote: Some more digging. 1. The following code will fix density plots for me: --- .ps.prolog=grDevices:::.ps.prolog i=grep(/p2,.ps.prolog) .ps.prolog[i] = /p2 { bg gsave fill grestore 0.001 setlinewidth stroke

Re: [Rd] Assignment of individual values to data frame columns: intentional or unintentional behavior?

2010-08-05 Thread Michael Lachmann
Ulrike Grömping wrote: However, given the documentation that partial matching is not used on the left-hand side, I would have expected even more that the assignment sw$Fert[1] - 10 works differently, because I am using it on the left-hand side. Probably, extraction ([1]) is done

[Rd] rbind on data.frame that contains a column that is also a data.frame

2010-08-05 Thread Michael Lachmann
Hi, The following was already a topic on r-help, but after understanding what is going on, I think it fits better in r-devel. The problem is this: When a data.frame has another data.frame in it, rbind doesn't work well. Here is an example: -- a=data.frame(x=1:10,y=1:10) b=data.frame(z=1:10)

[Rd] Using 'dimname names' in aperm() and apply()

2010-07-29 Thread Michael Lachmann
, length(d.ans)) dn.ans - c(list(ans.names), dn.ans) return(array(ans, c(len.a%/%d2, d.ans), if (!all(sapply(dn.ans, is.null))) dn.ans)) } return(ans) } -- Thanks, Michael -- Michael Lachmann, Max Planck institute of evolutionary anthropology Deutscher