rep is a base package function in R to replicate the elements of a vector
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 repWhen 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 repI am trying to replicate a dataframe (zoo object) 50 times as a whole, and get the result as a matrix, …
r dataframe repI am trying to calculate a median value across a number of columns, however my data is a bit funky. …
r data.table lapply repI have some problem with rep function in dplyr, for example code like this works fine d <- data.…
r dplyr rep