R - Summary

> Procedural Languages > R

1 - About

Advertising

3 - Package Function

3.1 - Base

summary is a generic function used to produce result summaries of the results of various model fitting functions.

The function invokes particular methods which depend on the class of the object (ie first argument).

x = rnorm(50,5,4)
xSummary <- summary(x)
xSummary
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 -4.963   3.434   5.706   5.800   8.119  16.140 

For a data frame, you got to see the following for each variable:

Export it:

exportFile <- file("C:/temp/Myfile.tsv",open="w")
write.table(xSummary, sep="\t") 
close(exportFile)

3.2 - Psych

psych package

3.2.1 - Total

# Load packages
library(psych)
 
# You can save the content of this function
mySummaryTable = describe(myData)

3.2.2 - By

3.2.2.1 - describeBy

The describeBy function reports basic summary statistics by a grouping variable.

Useful if:

  • the grouping variable is some experimental variable (ie dependent variable)
  • the data are to be aggregated for plotting.

Partly a wrapper of the describe function.

An alternative function statsBy returns a list of means, n, and standard deviations for each group.

Advertising
3.2.2.2 - statsBy

statsBy is an alternative function an describeBy that returns a list of:

for each group.

3.3 - Dplyr

See also: R - Dplyr (Data Frame Operations) and the summarize function.

lang/r/summary.txt · Last modified: 2017/11/17 11:00 by 172.68.253.189