group_by() and summarise( sum()) functions results NA in some cells

I tried using tidyverse/dplyr to create a table from a raw dataframe with 777,546 rows and 23 columns.
When I used group_by () and summarise( sum()) functions, it results NA in some cells. Meanwhile when I try to do pivot in excel, it works perfectly.
Anybody plese tell me what's caused this issue.

Read the documentation for the sum() function, most likely there are missing values (NA) in your data frame, if you want to ignore them, you need to set na.rm = TRUE

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like

Solved!
I found out some missing values in the dataframe.
na.rm() function helps me solving this issue.
Thanks

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.