Top "Rep" questions

rep is a base package function in R to replicate the elements of a vector

How to create a matrix from vector returned by rep() function?

x=1:20 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 rep(x,2) [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 View(rep(x,2)) Having a problem with generating a 20 by 2 vector using the rep() function in R. …

r matrix vector rep
rep function in R

When I perform: rep(1:4, rep(4,4)) I get 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 which is expected. But then when I try to fix the length to 16(…

r rep
Replicating a dataframe as a whole n times

I am trying to replicate a dataframe (zoo object) 50 times as a whole, and get the result as a matrix, …

r dataframe rep
calculate median from data.table columns in R

I am trying to calculate a median value across a number of columns, however my data is a bit funky. …

r data.table lapply rep
rep invalid 'times' argument in dplyr summarize

I have some problem with rep function in dplyr, for example code like this works fine d <- data.…

r dplyr rep