replicate

How to bootstrap a function with replacement and return the output

假如想象 提交于 2019-12-13 07:02:57
问题 I am trying to take two randomly drawn subsamples from a data frame, extract the means of a column in the subsamples and calculate the difference between means. The below function and use of replicate within do.call should work as far as I can tell, but I keep getting an error message: Example data: > dput(a) structure(list(index = 1:30, val = c(14L, 22L, 1L, 25L, 3L, 34L, 35L, 36L, 24L, 35L, 33L, 31L, 30L, 30L, 29L, 28L, 26L, 12L, 41L, 36L, 32L, 37L, 56L, 34L, 23L, 24L, 28L, 22L, 10L, 19L),

Laravel 4: replicate to table

拈花ヽ惹草 提交于 2019-12-12 02:48:14
问题 how to clone table row from one table to another i found way to make a clone but dont know how to insert it in other table I have Data class and Product class and I want to clone from Data to Product one row only public function getClone($id) { $item = Data::find($id); $clone = $item->replicate(); unset($clone['created_at'],$clone['updated_at']); $product = new Product; --> what goes here i tried $product->fill($clone); But i get error: must be of the type array, object given return Redirect:

xpages partial refresh can't save after replicate local replica

青春壹個敷衍的年華 提交于 2019-12-11 05:41:49
问题 Scenario: User preview xpage for editing in web browser. Developer replicate a local replica to the server. User click save button and trigger save action partial/full refresh In 8.5.2 crash the whole database based on can't find java design classes. In 8.5.3 no error CS/SS accrued but there are no changes applied to the document. Seems like if you replicate the sessionID is overridden. Is there a way to fix/detect it? Any ideas? thx 回答1: It relates to this effect: Meaning of java.lang

Calculating the mean of every replication

a 夏天 提交于 2019-12-04 07:13:23
问题 I have the following code set.seed(30) nsim <- 50 ## NUMBER OF REPLICATIONS demand <- c(12,13,24,12,13,12,14,10,11,10) res <- replicate(nsim, { load <- runif(10,11,14) diff <- load - demand ## DIFFERENCE BETWEEN DEMAND AND LOAD return(sum(diff < 0)) }) res [1] 6 5 7 4 4 5 4 3 6 4 5 5 5 4 2 5 3 3 3 5 3 2 4 6 5 4 4 3 5 6 4 4 3 6 5 3 5 5 4 3 3 [42] 6 4 4 4 6 6 5 4 5 I have a huge data set and the question is what is the fastest way of calculating the mean for every replication. For example the

Repeating a user-defined function using replicate() or sapply()

南楼画角 提交于 2019-12-03 05:15:55
问题 I have defined a custom function, like this: my.fun = function() { for (i in 1:1000) { ... for (j in 1:20) { ... } } return(output) } which returns an output matrix, output , composed by 1000 rows and 20 columns. What I need to do is to repeat the function say 5 times and to store the five output results into a brand new matrix, say final , but without using another for-loop (this for making the code clearer, and also because in a second moment I would like to try to parallelize these

Repeating a user-defined function using replicate() or sapply()

纵饮孤独 提交于 2019-12-02 18:33:07
I have defined a custom function, like this: my.fun = function() { for (i in 1:1000) { ... for (j in 1:20) { ... } } return(output) } which returns an output matrix, output , composed by 1000 rows and 20 columns. What I need to do is to repeat the function say 5 times and to store the five output results into a brand new matrix, say final , but without using another for-loop (this for making the code clearer, and also because in a second moment I would like to try to parallelize these additional 5 repetitions). Hence final should be a matrix with 5000 rows and 20 columns (the rationale behind

How to duplicate a MySQL database on the same server

三世轮回 提交于 2019-12-02 16:58:12
I have a large MySQL database, lets call it live_db , which I want to replicate on the same machine to provide a test system to play around with ( test_db ), including table structure and data. In regular intervals I want to update the test_db with the content of the live_db ; if possible incremental. Is there some built-in mechanism in MySQL to do that? I think that master-slave replication is not the thing I want since it should be possible to alter data in the test_db . These changes do not have to be preserved, though. Regards, CGD The mysql command line client will accept a stream of SQL

Calculating the mean of every replication

房东的猫 提交于 2019-12-02 13:36:21
I have the following code set.seed(30) nsim <- 50 ## NUMBER OF REPLICATIONS demand <- c(12,13,24,12,13,12,14,10,11,10) res <- replicate(nsim, { load <- runif(10,11,14) diff <- load - demand ## DIFFERENCE BETWEEN DEMAND AND LOAD return(sum(diff < 0)) }) res [1] 6 5 7 4 4 5 4 3 6 4 5 5 5 4 2 5 3 3 3 5 3 2 4 6 5 4 4 3 5 6 4 4 3 6 5 3 5 5 4 3 3 [42] 6 4 4 4 6 6 5 4 5 I have a huge data set and the question is what is the fastest way of calculating the mean for every replication. For example the res in first replication is 6 so the result should be 6/1=6 for the second 6+5/2=5.5 for the third 6+5+7

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

我的未来我决定 提交于 2019-11-30 10:15:28
问题 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

Repeating a repeated sequence

家住魔仙堡 提交于 2019-11-30 05:05:12
We want to get an array that looks like this: 1,1,1,2,2,2,3,3,3,4,4,4,1,1,1,2,2,2,3,3,3,4,4,4,1,1,1,2,2,2,3,3,3,4,4,4 What is the easiest way to do it? 42- You can do it with a single rep call. The each and times parameters are evaluated sequentially with the each being done first. rep(1:4, times=3, each=3) #[1] 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4 Or, simpler (assuming you mean a vector, not an array) rep(rep(1:4,each=3),3) 42-'s answer will work if your sequence of numbers incrementally increases by 1. However, if you want to include a sequence of numbers