[R] Transposing the output of 'table'
Berend Hasselman
bhh at xs4all.nl
Sun Oct 6 21:26:40 CEST 2013
On 06-10-2013, at 20:32, Dennis Fisher <fisher at plessthan.com> wrote:
> unsuccessful
>
Please reply to the list and not to me only.
That way others can contribute to solving the problem.
Berend
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
>
>
> On Oct 6, 2013, at 10:44 AM, Berend Hasselman <bhh at xs4all.nl> wrote:
>
>>
>> On 06-10-2013, at 19:30, Dennis Fisher <fisher at plessthan.com> wrote:
>>
>>> R 3.0.1
>>> OS X
>>>
>>> Colleagues,
>>>
>>> If I execute the command:
>>> table(OBJECT)
>>> the output might look like:
>>> 1 2
>>> 25 336
>>>
>>> I would like it to appear as:
>>> 1 25
>>> 2 336
>>>
>>> I can accomplish this with:
>>> TABLE <- table(OBJECT)
>>> data.frame(names(TABLE), as.numeric(TABLE))
>>>
>>> However, I bet that a more clever approach exists? Any takers?
>>
>>
>> Have you tried t(table(OBJECT)) ?
>>
>> Berend
>>
>
More information about the R-help
mailing list