I am new to R, and want to sort a data frame called \"weights\". Here are the details:
>str(weights)
\'data.frame\': 57 obs. of 1 variable:
$ attr_imp
Since your data.frame only has one column, you need to set drop=FALSE to prevent the dimensions from being dropped:
weights[order(-weights$attr_importance),,drop=FALSE]
# attr_importance
# our 0.125433292
# all 0.098185517
# address 0.090686474
# over 0.075182467
# make 0.049630556
# num3d 0.007122618