replicate

How do you fix a bug you can't replicate?

ぐ巨炮叔叔 提交于 2019-11-29 19:31:29
The question says it all. If you have a bug that multiple users report, but there is no record of the bug occurring in the log, nor can the bug be repeated, no matter how hard you try, how do you fix it? Or even can you? I am sure this has happened to many of you out there. What did you do in this situation, and what was the final outcome? Edit: I am more interested in what was done about an unfindable bug, not an unresolvable bug. Unresolvable bugs are such that you at least know that there is a problem and have a starting point, in most cases, for searching for it. In the case of an

Using “…” and “replicate”

杀马特。学长 韩版系。学妹 提交于 2019-11-29 13:23:47
In the documentation of sapply and replicate there is a warning regarding using ... Now, I can accept it as such, but would like to understand what is behind it. So I've created this little contrived example: innerfunction<-function(x, extrapar1=0, extrapar2=extrapar1) { cat("x:", x, ", xp1:", extrapar1, ", xp2:", extrapar2, "\n") } middlefunction<-function(x,...) { innerfunction(x,...) } outerfunction<-function(x, ...) { cat("Run middle function:\n") replicate(2, middlefunction(x,...)) cat("Run inner function:\n") replicate(2, innerfunction(x,...)) } outerfunction(1,2,3) outerfunction(1

Create list of single item repeated N times

谁说胖子不能爱 提交于 2019-11-25 22:47:02
问题 I want to create a series of lists, all of varying lengths. Each list will contain the same element e , repeated n times (where n = length of the list). How do I create the lists, without using a list comprehension [e for number in xrange(n)] for each list? 回答1: You can also write: [e] * n You should note that if e is for example an empty list you get a list with n references to the same list, not n independent empty lists. Performance testing At first glance it seems that repeat is the