Conversation

? #rstats friends - I'm trying to copy and insert every value after itself in a vector. Ex: v1 <- c('a','b') into v2 <- c('a','a','b','b') Would a for loop work instead of multiple instances of: append(values = v1[1], after = 1) %>% append(values = v1[2], after = 2) ...
4
Replying to
Someone recommended this: rep(c("a","b"),20) %>% sort() [1] "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" [40] "b"
1
2