tmp_df[order(tmp_df$Democratic),] Precinct Last.Name Democratic Republican.Total Registered.Voters 2 2904 Open Seat 1 0 15 NA 2903 Open Seat 227 245 2035 3 2905 Open Seat 71 202 497
tmp_df[order(tmp_df[3]),] Precinct Last.Name Democratic Republican.Total Registered.Voters 2 2904 Open Seat 1 0 15 NA 2903 Open Seat 227 245 2035 3 2905 Open Seat 71 202 497 > tmp_df$Democratic[order(tmp_df$Democratic)] [1] "1" "227" "71" What am I doing wrong? I would like the order below. I suspect the problem lies with that NA to the left that R inserted somewhere along the line. So how to reorder dataframe rows? Or get rid of that NA? 2 2904 Open Seat 1 0 15 3 2905 Open Seat 71 202 497 NA 2903 Open Seat 227 245 2035 Thanks, Jim Burke [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.