-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDescribe.R
43 lines (27 loc) · 1.06 KB
/
Describe.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File: Describe.R
# Course: R: An Introduction (with RStudio)
# INSTALL AND LOAD PACKAGES ################################
library(datasets) # Load base packages manually
# Installs pacman ("package manager") if needed
if (!require("pacman")) install.packages("pacman")
# Use pacman to load add-on packages as desired
pacman::p_load(pacman, psych)
# LOAD DATA ################################################
head(iris)
# PSYCH PACKAGE ############################################
# Get info on package
p_help(psych) # Opens package PDF in browser
p_help(psych, web = F) # Opens help in R Viewer
# DESCRIBE() ###############################################
# For quantitative variables only.
describe(iris$Sepal.Length) # One quantitative variable
describe(iris) # Entire data frame
# CLEAN UP #################################################
# Clear environment
rm(list = ls())
# Clear packages
p_unload(all) # Remove all add-ons
detach("package:datasets", unload = TRUE) # For base
# Clear console
cat("\014") # ctrl+L
# Clear mind :)