R Sort Variables of Data Frame by Column Names (2 Examples) | Order Alphabetically | Base vs. dplyr

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

d = letters[1:5],
c = 3,
b = 5:1)

data_new1 <- data[ , order(names(data))] # Apply order & names

library("dplyr")

data_new2 <- data %>% # Sort with dplyr
select(sort(names(.)))

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

Great job my brother the explanation was simple and clear

husseinali