Help summarize()

Hi, I need help as to why my summarize() does not summarize all the values shows NA instead.

install.packages("dplyr")
install.packages("tidyverse")
install.packages("ggplot2")
install.packages("zoo")
install.packages("lubridate")

library(dplyr)
library(tidyverse)
library(zoo)
library(lubridate)

nps_3 %>%
group_by(Month) %>%
summarize(pct= mean(nps_score))

Output:
Month pct

1 3 0.757
2 4 NA
3 5 NA
4 6 NA
5 7 NA
6 8 NA
7 9 NA

If any of the values in nps_score are NA, then the mean will be NA. To ignore these, use mean(nps_score, na.rm = T).

1 Like

Thanks a lot it worked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.