see the manual from package sqldf:
http://cran.r-project.org/web/packages/sqldf/sqldf.pdf
Bart
--
View this message in context:
http://r.789695.n4.nabble.com/SQL-R-tp2298545p2301975.html
Sent from the R help mailing list archive at Nabble.com.
__
R-h
Thanks for your answers,
Best,
Gildas
Brian Diggs a écrit :
> On 7/22/2010 5:01 AM, Allan Engelhardt wrote:
>> There are so many ways Here is one:
>>
>> aggregate(v ~ u, data=X, function(...) length(unique(...)))
>> # u v
>> # 1 T1 2
>> # 2 T2 1
>>
>> Hope this helps
>
> Here is one othe
On 7/22/2010 5:01 AM, Allan Engelhardt wrote:
There are so many ways Here is one:
aggregate(v ~ u, data=X, function(...) length(unique(...)))
# u v
# 1 T1 2
# 2 T2 1
Hope this helps
Here is one other way, using the plyr package (which is very good for
taking a data structure (data.frame
There are so many ways Here is one:
aggregate(v ~ u, data=X, function(...) length(unique(...)))
#u v
# 1 T1 2
# 2 T2 1
Hope this helps
Allan.
On 22/07/10 12:52, Gildas Mazo wrote:
Dear R users,
I want to aggregate data in the following way:
###
X<- data.frame(u = c("T1","T1","T1",
Dear R users,
I want to aggregate data in the following way:
###
X <- data.frame(u = c("T1","T1","T1","T2"), v=c("a","a","b","a"))
X
library(sqldf)
sqlOut <- sqldf("select count(distinct(v)) from X group by u")
sqlOut
###
Now I want to get the same result without using SQL. How can I achieve
t
5 matches
Mail list logo