Re: [R] replicate rows

2018-07-08 Thread radmuzom .
;- unlist(Map(f, 1:nrow(df))) df2 <- df[rowindex_rep, ] Regards, radmuzom From: R-help on behalf of Eric Berger Sent: Sunday, July 8, 2018 3:21 PM To: catalin roibu Cc: R Project Help Subject: Re: [R] replicate rows   Hi Catalin, This should work. I set the number of repetitions and s

Re: [R] replicate rows

2018-07-08 Thread Eric Berger
Hi Catalin, This should work. I set the number of repetitions and sample sizes as variables so it would be clear how to modify for your actual case. nreps<- 3 sampSize <- 2 w <- unlist( lapply(1:nreps, function(i) { rep(paste("R",i,sep=""),sampSize) } ) ) aa2 <- cbind( as.data.frame(aa), w)

[R] replicate rows

2018-07-08 Thread catalin roibu
Dear R users, I want to replicate sampled rows in data frame. The sampling results must be in this form: a b Rep [1,] 3 4.0 R1 [2,] 6 8.0 R1 [3,] 1 0.1 R2 [4,] 6 8.0 R2 [5,] 1 0.1 R3 [6,] 5 7.0 R3 I have a code but I didn't succeed to insert to rep column. This is my code:

[R] replicate rows

2012-02-03 Thread Schumacher, G.
Hello, I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? Kind regards / Met vriendelijke groet / Med venlig hilsen, Dr. Gijs Schumacher Postdoctoral Researcher Department of Political Science and Public

Re: [R] replicate rows

2012-02-03 Thread jim holtman
It is not clear to me exactly what you are trying to do. Can you show a short example of some input and then what the output would look like? When you say you only want to replicated the rows, what happens to the columns? Is each matrix going to have only one column? So some more clarification

Re: [R] replicate rows

2012-02-03 Thread Ernest Adrogué
3-02-2012, 11:26 (+); Schumacher, G. escriu: I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? If x is your matrix, this x[rep(1:17, 20),] will give you a matrix with 340 rows and 20 columns

Re: [R] replicate rows

2012-02-03 Thread Petr PIKAL
Hi Hello, I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? Replicate index. x-matrix(1:4, 2,2) x[rep(1:2, 20),] Regards Petr Kind regards / Met vriendelijke groet / Med venlig hilsen, Dr.