tmp.out.sort <- tmp.out[, order(names(tmp.out))]

tmp.out.sort <- tmp.out[, order(names(tmp.out)), drop=FALSE]

>From your description of misbehavior with a single column,
I think the drop=FALSE argument will provide the protection you need.
Then you will not need the if clause.

See

?`[.data.frame`
for the story and examples.


Rich

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to