Set Column Names when Using cbind Function in R (Examples) | Rename Variables | colnames() Function

preview_player
Показать описание
R code of this video:

vec1 <- letters[3:7] # Create first example vector
vec1 # Print first example vector

vec2 <- 8:4 # Create second example vector
vec2 # Print second example vector

data1 <- cbind(vec1, vec2) # Applying cbind
data1 # Print updated data

colnames(data1) <- c("col1", "col2") # Applying colnames
data1 # Print updated data

data2 <- cbind(x1 = vec1, x2 = vec2) # Applying cbind with names
data2 # Print updated data

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

I'm new to Analytics, and you're a lifesaver. This video and colnames have saved me tons of mental anguish. lol. You're a blessing

chazrooks
visit shbcf.ru