"Charles C. Berry" wrote: > On Thu, 23 Oct 2014, Sebastien Vauban wrote: >> >> The following code does return a corrupted answer, while it's supposed >> to return a sorted dataframe. > > Not so. See below.
So, that's RStudio that's wrong, in some way? >> --8<---------------cut here---------------start------------->8--- >> #+BEGIN_SRC R :results value replace >> con <- textConnection(" >> index email >> A abc-hcdggtzh8xnbdgjk7y7...@public.gmane.org >> B def-hcdggtzh8xnbdgjk7y7...@public.gmane.org >> C def-hcdggtzh8xnbdgjk7y7...@public.gmane.org >> D ghi-hcdggtzh8xnbdgjk7y7...@public.gmane.org >> E abc-hcdggtzh8xnbdgjk7y7...@public.gmane.org >> F def-hcdggtzh8xnbdgjk7y7...@public.gmane.org") >> df <- read.table(con, header = TRUE) >> sort(table(df$email)) >> #+END_SRC >> >> #+results: >> | 1 | >> | 2 | >> | 3 | >> --8<---------------cut here---------------end--------------->8--- > > You created a `table' object, then you sorted it creating an `array' > object- an object of a different class. > > Is this what you want? > > #+BEGIN_SRC R :results value replace > con <- textConnection(" > index email > A abc-hcdggtzh8xnbdgjk7y7...@public.gmane.org > B def-hcdggtzh8xnbdgjk7y7...@public.gmane.org > C def-hcdggtzh8xnbdgjk7y7...@public.gmane.org > D ghi-hcdggtzh8xnbdgjk7y7...@public.gmane.org > E abc-hcdggtzh8xnbdgjk7y7...@public.gmane.org > F def-hcdggtzh8xnbdgjk7y7...@public.gmane.org") > df <- read.table(con, header = TRUE) > as.table(sort(table(df$email))) > #+END_SRC > > #+RESULTS: > | ghi-hcdggtzh8xnbdgjk7y7...@public.gmane.org | 1 | > | abc-hcdggtzh8xnbdgjk7y7...@public.gmane.org | 2 | > | def-hcdggtzh8xnbdgjk7y7...@public.gmane.org | 3 | Yes, it is. Thanks! Best regards, Seb -- Sebastien Vauban