"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 [email protected]
>> B [email protected]
>> C [email protected]
>> D [email protected]
>> E [email protected]
>> F [email protected]")
>> 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 [email protected]
> B [email protected]
> C [email protected]
> D [email protected]
> E [email protected]
> F [email protected]")
> df <- read.table(con, header = TRUE)
> as.table(sort(table(df$email)))
> #+END_SRC
>
> #+RESULTS:
> | [email protected] | 1 |
> | [email protected] | 2 |
> | [email protected] | 3 |
Yes, it is. Thanks!
Best regards,
Seb
--
Sebastien Vauban