How to calculate skewness of all the numeric columns in the data frame

Suppose you have Sales data like this. Now you want to calculate the skewness of all the numeric columns such as “Sales”, “Quantity” etc. Here is how.

Install “moments” package (You need this only for the 1st time.)

  1. Open the “Manage R Package” dialog from the project menu.

  1. Choose “Install New Packages”, type in “moments” and click “Install”.

image

Calculate skewness for all the numeric columns.

  1. Select “Custom R Command” from the + button.

  1. Type in the command following to calculate skewness for each numeric column by “moments::skewness” function.
summarize(across(
  is.numeric, 
  list(skewness =  ~ moments::skewness(.x, na.rm = TRUE))
))

Now you get the skewness for all the numeric columns in the data frame.

2 Likes