Hi,
below is my data frame… I want to count the medals for each country (denoted in NOC column)…
Since there are team events (here every row corresponds to one athlete) i have to count unique event medals.
SO I am trying to count Combination of Event, Event_gender, Medal with following code.
y= ddply(data1_2000 , .(NOC), function(df) count(df[,c(“Event”,“Event_gender”,“Medal”) ]))
I also tried
z= sqldf(“select NOC,COUNT(distinct Event,Event_gender,Medal) as MedalCount from data1_2000 group by NOC”)
here am getting an error :
Error in sqliteSendQuery(con, statement, bind.data) :
error in statement: wrong number of arguments to function COUNT()
But am not getting the desired result.
please suggest somethng.