[R] R equivalent for SQL query
Steven Raemaekers
s.raemaekers at sig.eu
Tue Apr 3 21:26:49 CEST 2012
I'm sorry, but I think that's just plain rude. This is exactly the reason why people do not like to ask for help on mailing lists and internet forums.
The help file is full of valuable information, if you know exactly where to look. For someone who doesn't know this, it is rather more complicated.
There are several options in the help file of table, and I do not know exactly how to apply this function or which options to choose.
So, again, can anyone help me to translate this query to R? Thanks!
Regards,
Steven
On 3 apr. 2012, at 21:07, Bert Gunter wrote:
> If reading the help file for the function that does what I think you
> want is not helpful enough, you'll have to seek elsewhere. I expect
> some minimal learning effort.
>
> (?table means type this at the prompt in the GUI).
>
> -- Bert
>
> On Tue, Apr 3, 2012 at 12:04 PM, Steven Raemaekers <s.raemaekers at sig.eu> wrote:
>> Thanks. Excuse me for saying this, but that is not very helpful. Can you provide **one**, since that would be enough…:P
>>
>> On 3 apr. 2012, at 21:01, Bert Gunter wrote:
>>
>>> ?table
>>>
>>> There are **many** other ways.
>>>
>>> -- Bert
>>>
>>> On Tue, Apr 3, 2012 at 11:26 AM, Steven Raemaekers <s.raemaekers at sig.eu> wrote:
>>>> Hi,
>>>>
>>>> I have a query which I would like to translate into R, but I do not know how to do it in an easy way.
>>>> Assume a data frame has columns A, B and C:
>>>>
>>>> A B C
>>>> 1 1 3
>>>> 1 1 4
>>>> 1 1 5
>>>> 1 2 6
>>>> 1 2 7
>>>> 1 3 8
>>>>
>>>> The query is as follows:
>>>>
>>>> select A, B, count(*)
>>>> from data.frame
>>>> group by A, B
>>>> order by count(*) desc
>>>>
>>>> How do I translate this into R statements in such way that the result is a data frame structured as follows:
>>>>
>>>> A B count(*)
>>>> 1 1 3
>>>> 1 2 2
>>>> 1 3 1
>>>>
>>>> Thanks,
>>>>
>>>> Steven
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>> --
>>>
>>> Bert Gunter
>>> Genentech Nonclinical Biostatistics
>>>
>>> Internal Contact Info:
>>> Phone: 467-7374
>>> Website:
>>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>>
>>
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list