Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

How to sum all values of a column of in a data.frame?

Asked by Dominic Poole Jun 6, 2021 1.0K views 1 answer
Share

About this question

I have a data frame with several columns; some numeric and some character. How to compute the sum of a specific column? I’ve googled for this and I see numerous functions (sum, cumsum, rowsum, rowSums, colSums, aggregate, apply) but I can’t make sense of it all.

For example, suppose I have a data frame people with the following columns

Name Height Weight
Mary 65     110
John 70     200
Jane 64     115
…

How do I get the sum of all the weights?

Your answer

1 Answer

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.