I plan to use a loop to go through a few 100 columns and calculate a median and count against a set of variables.
Code :
grp_var <- "Species"
voi <- "Sepal.Length"
dmp <- iris%>%
select_(grp_var,voi)%>%
group_by_(grp_var)%>%
summarise_(Median_Value = median(voi),Count = n())
Error :
Error in n() : This function should not be called directly
I face this error when i use summarise_ and don't face any issues at all when i use summarise.
I know that the function call to n() is just the error message but when called within a dplyr function it should return the row count. Am i just being dumb about this or is this a bug ?
Edit : I don't have any conflicts for the summarise function , plyr isn't loaded.