[R] how to get a numeric vector?

Mohammad Tanvir Ahamed m@@hr@ng@ @end|ng |rom y@hoo@com
Mon Oct 5 09:45:32 CEST 2020


Hi, 
You can try this. 

Example: 1
a <- c(1, 4)
b <- c(5, 8)
unlist(as.vector(mapply(seq,a,b)))
> [1]  1 2 3 4 5 4 5 6 7 8


a <- c(1, 4, 2)
b <- c(5, 8, 10)
unlist(as.vector(mapply(seq,a,b)))
>  [1]  1  2  3  4  5  4  5  6  7  8  2  3  4  5  6  7  8  9 10


Regards.............
Tanvir Ahamed 
Stockholm, Sweden     |  mashranga using yahoo.com 






On Monday, 5 October 2020, 12:47:52 am GMT+2, vod vos via R-help <r-help using r-project.org> wrote: 





Hi,

a <- c(1, 4)
b <- c(5, 8)

a:b

[1] 1 2 3 4 5
Warning messages:
1: In a:b : numerical expression has 2 elements: only the first used
2: In a:b : numerical expression has 2 elements: only the first used

how to get:

c(1:5, 4:8)

Thanks.

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list