The key with ordering is to set the levels of the factor in the order you want; an ordered factor is not required, the extra information in an ordered factor isn't necessary and if these data are being used in any statistical model, the wrong parametrisation might result - polynomial contrasts aren't right for nominal data such as this.
The key with ordering is to set the levels of the factor in the order you want; an ordered factor is not required, the extra information in an ordered factor isn't necessary and if these data are being used in any statistical model, the wrong parametrisation might result - polynomial contrasts aren't right for nominal data such as this. ## set the levels in order we want theTable.
1 that's a good point Gavin – Prasad Chalasani Mar 6 at 14:51 @Gavin: 2 simplifications: since you already are using within, there's no need to use theTable$Position, and you could just do sort(-table(...)) for decreasing order. – Prasad Chalasani Mar 6 at 15:16 @Prasad the former was a leftover from testing so thanks for pointing that out. As far the latter, I prefer explicitly asking for the reversed sort than the - you use as it is far easier to get the intention from decreasing = TRUE than noticing the - in all the rest of the code.
– Gavin Simpson Mar 6 at 15:22 @Gavin ok I see what you mean – Prasad Chalasani Mar 6 at 15:34 @Prasad - it it just personal preference after many years writing analysis scripts in my work that I have had to revisit at times and cursed myself for not writing clearer code. There is nothing wrong with using -. – Gavin Simpson Mar 6 at 15:39.
You just need to specify the Position column to be an ordered factor where the levels are ordered by their counts: theTable.
I didn't fully parse your code up there, but I'm pretty sure reorder() from the stats library accomplishes the same task. – Chase Mar 6 at 13:44 @Chase how do you propose using reorder() in this case? The factor requiring reordering needs to be reordered by some function of itself and I'm struggling to see a good way to do that.
– Gavin Simpson Mar 6 at 14:23 ok, with(theTable, reorder(Position, as. Character(Position), function(x) sum(duplicated(x)))) is one way, and another with(theTable, reorder(Position, as. Character(Position), function(x) as.
Numeric(table(x)))) but these are just as convoluted... – Gavin Simpson Mar 6 at 14:39 I simplified the answer slightly to use sort rather than order – Prasad Chalasani Mar 6 at 14:55 @Gavin - perhaps I misunderstood Prasad's original code (I don't have R on this machine to test...) but it looked as if he was reordering the categories based on frequency, which reorder is adept at doing. I agree for this question that something more involved is needed. Sorry for the confusion.
– Chase Mar 6 at 15:45.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.