Thank you all for your input - most appreciated.
Best, Peter
Am 21.10.2017 07:35 schrieb "Rui Barradas" :
> Hello,
>
> In order to solve that problem of sorting numerics made characters there
> is package stringr, functions str_sort and str_order.
>
> library(stringr)
>
> set.seed(2447)
>
> x <-
Hello,
In order to solve that problem of sorting numerics made characters there
is package stringr, functions str_sort and str_order.
library(stringr)
set.seed(2447)
x <- sample(11L)
sort(as.character(x))
[1] "1" "10" "11" "2" "3" "4" "5" "6" "7" "8" "9"
str_sort(as.character(x), nu
Hi,
On 10/20/2017 12:53 PM, Peter Meissner wrote:
Thanks, for the explanation.
Still, I think this is surprising bahaviour which might be handled better.
Maybe a little surprising, but no more than:
> x <- sample(11L)
> sort(x)
[1] 1 2 3 4 5 6 7 8 9 10 11
> sort(as.character(x))
Thanks, for the explanation.
Still, I think this is surprising bahaviour which might be handled better.
Best, Peter
Am 20.10.2017 9:49 nachm. schrieb "Iñaki Úcar" :
> Hi Peter,
>
> 2017-10-20 21:33 GMT+02:00 Peter Meissner :
> > Hey,
> >
> > I found this - for me - quite surprising and puzzling
Hi Peter,
2017-10-20 21:33 GMT+02:00 Peter Meissner :
> Hey,
>
> I found this - for me - quite surprising and puzzling behaviour of split().
>
>
> split(1:11, as.character(1:11))
> split(1:11, 1:11)
>
>
> When splitting by numerics everything works as expected - sorting of input
> == sorting of ou
Hey,
I found this - for me - quite surprising and puzzling behaviour of split().
split(1:11, as.character(1:11))
split(1:11, 1:11)
When splitting by numerics everything works as expected - sorting of input
== sorting of output -- but when using a character vector everything gets
re-sorted alph