Sort a data frame when column name is assigned in a variable
Your first attempt was more accurate. Since I do not have your data I will just use the iris data set,

 iris_ordered_on_Sepal_Length &lt;- iris[order(iris$Sepal.Length),]


or if you use data.table,

iris_dt &lt;- data.table(iris)
iris_dt[order(Sepal.Length)]


data.table will make renaming easier too,

setnames(input, c("colname_11, "colname_17", "colname_23"), validoutcomes[1 : 3])