Search
 
SCRIPT & CODE EXAMPLE
 

R

reorder dataframe cols r

col_order <- c("Species", "Petal.Width", "Sepal.Length",
               "Sepal.Width", "Petal.Length")
my_data2 <- my_data[, col_order]
Comment

r - reorder columns in data frame

# Reorder by column name
df <- df[c("A", "B", "C")]

# Reorder by column index
df <- df[c(1, 3, 2)]
Comment

reorder columns in r

col_order <- c("Species", "Petal.Width", "Sepal.Length",
               "Sepal.Width", "Petal.Length")
my_data2 <- my_data[, col_order]
my_data2

# or
my_data2 <- my_data[, c(5, 4, 1, 2, 3)]
Comment

PREVIOUS NEXT
Code Example
R :: extract residual from lm in r 
R :: extract coefficients from lm in r 
R :: How to calculate standardized residuals in R 
R :: predict in r stack 
R :: combine ro columns in r 
R :: turn a numeric dataframe to binary in r 
R :: read xlsx in r 
R :: two string in one string r 
R :: how to interpolate missing data in r with example 
R :: extract hyperlinks in r 
R :: sparklyr alternative for str_detect 
R :: eleminating a char in of a list in r 
R :: list variables r 
R :: exp() function R 
R :: hypergeometric distribution on r 
R :: r produce 10 alphabet 
R :: barplot_density 
R :: r count rows dataframe 
Rust :: sort a vec<f32 rust 
Rust :: assert rust 
Rust :: debug rust 
Rust :: use module within another module rust 
Rust :: how to make map in rust language 
Rust :: rust count distinct elements in list 
Rust :: rust spinning rod animation in text 
Rust :: greater than equal to rust 
Rust :: Vector with multiple types in rust 
Rust :: armanriazi•rust•function•vs•closure 
Lua :: how to execute scripts when a button gui is pressed roblox 
Lua :: roblox what is the difference between index and newindex 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =