# A/B testing for shoefly.com https://www.codecademy.com/courses/learn-r/projects/r-aggregates-shoefly

I’m struggling to figure out how to find the percentage of clicks per utm source in this project. I’m stuck on step 4 that says: "
To find the percentage of people who clicked on ads from each `utm_source` , we need to add a new column to `ad_clicks` that stores the `count` of clicks (or the `count` of not clicking) divided by the total number of ad views.

Group `clicks_by_utm` by `utm_source` and pipe the result into `mutate()` , creating a new column `percentage` that is defined as `count/sum(count)` .

Save your result to `percentage_by_utm` and view it. Open the hint for a description of the `percentage_by_utm` data frame."

The code it gives as the answer is the last line of code I included here and I can’t seem to get it to work. I’m not sure if I’m supposed to replace “count/sum(count)” with anything.

# Aggregates in R

Hide

``````# load packages
library(dplyr)
``````

Hide

``````# load ad clicks data
``````

Hide

``````# inspect ad_clicks here:
``````

user_id

utm_source

day

6 rows | 1-3 of 6 columns

Hide

``````# define views_by_utm here:
group_by(utm_source) %>%
summarize(views = n())
views_by_utm
``````

utm_source

views

4 rows

Hide

``````# define clicks_by_utm here:
summarize(clicks = n())
clicks_by_utm
``````

utm_source

clicks

``````# define percentage_by_utm here:
``````Error in sum(count): invalid 'type' (closure) of argument