Create a summary table of the particular column
In this approach to create the summary table of a particular column, the user has to create a vector of the column names and pass it as the parameter of the describe function to get the summary of the provided columns names from the dataframe in the R programming language.
Syntax:
describe(dataframe[ , c('column1', 'column2',........,'column n')],fast=TRUE)
Example:
In this example, we are going to get the summary table for subjects and percentages using describe function in the R language.
R
# load the library library (psych) # create dataframe data= data.frame (id= c (1,2,3,4,5), subjects= c ( "java" , "java" , "python" , "python" , "R" ), marks= c (90,89,77,89,89), percentage= c (78,89,66,78,90)) # get the summary table for subjects and percentage describe (data[ , c ( 'subjects' , 'percentage' )],fast= TRUE ) |
Output:
How to Create Summary Tables in R?
In this article, we will discuss how to create summary tables in R Programming Language.
The summary table contains the following information:
- vars: represents the column number
- n: represents the number of valid cases
- mean: represents the mean value
- median: represents the median value
- trimmed: represents the trimmed mean
- mad: represents the median absolute deviation
- min: represents the minimum value
- max: represents the maximum value
- range: represents the range of values
- skew: represents the skewness
- kurtosis: represents the kurtosis
- se: represents the standard error
Initial Data frame:
Let’s create a dataframe with 5 rows and 4 columns.
R
# create dataframe data = data.frame (id= c (1, 2, 3, 4, 5), subjects= c ( "java" , "java" , "python" , "python" , "R" ), marks= c (90, 89, 77, 89, 89), percentage= c (78, 89, 66, 78, 90)) # display data |
Output: