How to find the sum of column values of an R dataframe?
In this article, we are going to find the sum of the column values of a dataframe in R with the use of sum() function.
Creating a Dataframe
A dataframe can be created with the use of data.frame() function that is pre-defined in the R library. This function accepts the elements and the number of rows and columns that are required for the dataframe to be created.
Following is an R Program for the creation of dataframe:
row1 row2 row3 1 0 3 6 2 1 4 7 3 2 5 8
Computing Sum of Column Values
R language provides an in-built function sum() to compute the mean of a dataframe. Following is an R program for the implementation of sum().
6 92 240