merge_vectors | R Documentation |
Merge data from two vectors, either by names or by location. The second is merged into the first.
merge_vectors(v1, v2, byname = FALSE, overwrite_NA = FALSE)
v1 |
(vector) The first vector. |
v2 |
(vector) The second vector. |
byname |
(logical scalar) Whether to merge by name. Default = FALSE. |
overwrite_NA |
(logical scalar) When using byname, whether to overwrite NAs. Default = FALSE. |
#without names
t1 = c(NA, 2, 3, NA)
t2 = c(1, NA, NA, 4)
merge_vectors(t1, t2)
#with names
t1_n = c(NA, 2, 3, NA);names(t1_n) = letters[1:4]
t3_n = c(1, NA, NA, 4, 5);names(t3_n) = letters[1:5]
merge_vectors(t1_n, t3_n, byname = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.