search for: reorder_factor

Displaying 3 results from an estimated 3 matches for "reorder_factor".

2011 Aug 31
2
stumped on how to reorder factors
...ke sense (assuming I want the factor ordered by integer value), but I understand that this "mis-ordering" is because the ordering is based on a character string data type and not on an integer data type. Because I run into this problem frequently, I wrote a small function to fix this: reorder_factor = function(x, x_sum, decreasing=FALSE){ factor(as.character(x), levels=levels(x)[order(x_sum, decreasing=decreasing) ]) } I can then run the following code to fix the problem: A = reorder_factor(x=A, x_sum=as.numeric(levels(A)), decreasing=FALSE) levels(A) ... and now I have correctly orde...
2006 Aug 06
0
Reshape package: new version 0.7
...ply, an idempotent apply function that returns results with the same dimensionality as the input (very useful in conjunction with sweep and multidimensional arrays) * rescaler, a function to rescale data.frames variable by variable using a range of different scaling methods * combine_factor and reorder_factor to make it easier to combine and reorder factor levels * bug fixes! All feedback is welcomed, and if you are struggling with reshaping your data and the reshape package isn't helping, please let me know. Regards, Hadley http://had.co.nz/ _______________________________________________ R-p...
2006 Aug 06
0
Reshape package: new version 0.7
...ply, an idempotent apply function that returns results with the same dimensionality as the input (very useful in conjunction with sweep and multidimensional arrays) * rescaler, a function to rescale data.frames variable by variable using a range of different scaling methods * combine_factor and reorder_factor to make it easier to combine and reorder factor levels * bug fixes! All feedback is welcomed, and if you are struggling with reshaping your data and the reshape package isn't helping, please let me know. Regards, Hadley http://had.co.nz/ _______________________________________________ R-p...