Depending on what you think the output should be, I’m guessing you want the times=
parameter:
rep (a, times = c(2, 4, 7))
# [1] 2 2 4 4 4 4 6 6 6 6 6 6 6
See ?rep
for the difference
More Related Contents:
- Repeat vector when its length is not a multiple of desired total length
- R: replace the whole part of a number but keep the decimal part unchanged
- What is the difference between require() and library()?
- Why is the parallel package slower than just using apply?
- Scale a series between two points
- How to replace NA values in a table for selected columns
- Count the number of all words in a string
- R: gsub, pattern = vector and replacement = vector
- How do I calculate the co-occurrence in the table? [duplicate]
- Rcpp pass by reference vs. by value
- Replace / translate characters in a string
- using Unicode ‘dingbat-like’ glyphs in R graphics, across devices & platforms, especially PDF
- Count number of rows by group using dplyr
- Adding space between bars in ggplot2
- Dynamically build call for lookup multiple columns
- R Error in x$ed : $ operator is invalid for atomic vectors
- multiple graphs in one canvas using ggplot2
- Get all diagonal vectors from matrix
- Save plot with a given aspect ratio
- Error in plot.window(…) : need finite ‘xlim’ values
- multithreading with R?
- Installing package – cannot open file – permission denied
- Add column with order counts
- Why I get this error writing data to a file
- DT[!(x == .)] and DT[x != .] treat NA in x inconsistently
- How to cross-paste all combinations of two vectors (each-to-each)?
- Efficient calculation of matrix cumulative standard deviation in r
- Show correlations as an ordered list, not as a large matrix
- Should I avoid programming packages with pipe operators?
- 3d plot in R – Patch