Repeat vector when its length is not a multiple of desired total length
Use the length.out argument of rep() or rep_len (a “faster simplified version” [of rep]): length.out: non-negative integer. The desired length of the output vector Here is an example using the built-in dataset cars. str(cars) ‘data.frame’: 50 obs. of 2 variables: $ speed: num 4 4 7 7 8 9 10 10 10 11 … $ … Read more