Re: [Rd] How to safely using OpenMP pragma inside a .C() function?

2011-09-01 Thread Michael Lachmann
This is probably obvious, but I just wanted to say that it should be possible to turn off multithreading even when on a machine with multiple cores. Reasons could be because you run in a cluster, and are given just one core for yourself. Or, if you have a setup with trivial parallelization (i.e.

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-diagonaliza

Re: [Rd] An example of very slow computation

2011-08-17 Thread Michael Lachmann
then from 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, >

Re: [Rd] An example of very slow computation

2011-08-17 Thread Michael Lachmann
On 17 Aug 2011, at 7:08PM, wrote: > John C Nash 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 to >> be a factor of >1000. > > Looks like A

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 fun

[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. Mic

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

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

[Rd] slightly speeding up readChar()

2011-08-04 Thread Michael Lachmann
changes are also not that hard - I'd do them if people think such changes should be included 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
ot seem to come after the image neither > (this is perhaps to be expected from the note in ?plot.default). > > plot(1,1, panel.last={box(lwd=50, col="#FF")}) > > image(volcano, panel.last={box(lwd=50, col="#FF")}) > > sessionInfo() > R versio

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

2011-08-03 Thread Michael Lachmann
n image.default() the box 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

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

2011-08-03 Thread Michael Lachmann
t to overwrite part of the lines of the axes. 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] problem with dl tag in tools::Rd2HTML

2010-08-05 Thread Michael Lachmann
Michael Lachmann wrote: > > > Duncan Murdoch-2 wrote: >> >> >> What version are you using? I don't see that in current R patched. >> >> > > I see this in version 2.11.1. > This is the code I ran to generate it: > page <- utils

[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)

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])

Re: [Rd] problem with dl tag in tools::Rd2HTML

2010-08-05 Thread Michael Lachmann
Duncan Murdoch-2 wrote: > > > What version are you using? I don't see that in current R patched. > > I see this in version 2.11.1. This is the code I ran to generate it: page <- utils:::.getHelpFile(?options) tools::Rd2HTML(page,out="t.html") in the generated file, t.html, the first tag i

[Rd] problem with dl tag in tools::Rd2HTML

2010-08-05 Thread Michael Lachmann
I think tools::Rd2HTML has a problem with the dl tag. Under some conditions, and , and and are not nested correctly. Here is an example from the "options" doc file: -- save.defaults, save.image.defaults: see save. -- You can see that the starts, then starts, then end the paragraph, but th

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

2010-07-29 Thread Michael Lachmann
.ans)) dn.ans <- vector(mode = "list", 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 Platz. 6, 04103 Leipzig, Germany Tel: +49-341-3550521, Fax: +49-341-3550555 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel