x<-c(1:10)
y<-c (2:11)
x+y
can be done, but x:y
causes an error.
I want to create multiple columns, but only one is recognized.
I would appreciate it if you could let me know if you know any functions that can create such a sequence.
I'm sorry to bother you at such a busy time, but I appreciate your cooperation.
Example of the map2
function in the purr
package.
x<-c(1:3)
y<-c (2:4)
library(purrr)
map2 (.x=x, .y=y, .f=`:`)
[[1]]
[1] 1 2
[[2]]
[1] 2 3
[[3]]
[1] 3 4
© 2025 OneMinuteCode. All rights reserved.