I have a function:
v0 <- function(n) {
seq(1:n)
}
and I need to create a function v1
which gives this result:
(1 2 3 -4 -5 -6 7 8 9 -10) # if n <- 10 or
(1 2 3 -4 -5 -6 7 8 9 -10 -11 -12 13) # if n <- 13
But I keep getting a warning message when I do:
v1 <- function(n) {
seq(1:n) * c(1,1,1,-1,-1,-1)
}
Any tips on what is the right way to go about doing this?