How to merge multiple vector objects with different length in the R programming language. More details: statisticsglob...
R code of this video:
vec1 <- 1:6 # Create first example vector
names(vec1) <- letters[1:6]
vec1 # Print first example vector
vec2 <- 1:4 # Create second example vector
names(vec2) <- letters[1:4]
vec2 # Print second example vector
install.packages("qpcR") # Install qpcR package
library("qpcR") # Load qpcR package
data_cbind <- qpcR:::cbind.na(vec1, vec2) # Bind as columns
data_cbind # Print combined data
install.packages("dplyr") # Install & load dplyr
library("dplyr")
data_rbind <- as.data.frame(bind_rows(vec1, vec2)) # Bind as rows
data_rbind # Print combined data
Follow me on Social Media:
Facebook: / statisticsglobecom
LinkedIn: / statisticsglobe
Twitter: / joachimschork
Негізгі бет How to cbind & rbind Vectors with Different Length (R Example) | cbind.na & bind_rows | qpcR & dplyr
Пікірлер: 10