0% found this document useful (0 votes)
5 views2 pages

RStudio Command Reference Guide

The RStudio Command Reference Guide provides a comprehensive overview of commands for data analysis and visualization in R. It includes instructions for entering datasets, creating various types of graphs, and performing numerical descriptive statistics. Additionally, it covers probability calculations using normal distribution functions.

Uploaded by

aqsaghafar.777
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

RStudio Command Reference Guide

The RStudio Command Reference Guide provides a comprehensive overview of commands for data analysis and visualization in R. It includes instructions for entering datasets, creating various types of graphs, and performing numerical descriptive statistics. Additionally, it covers probability calculations using normal distribution functions.

Uploaded by

aqsaghafar.777
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

RStudio Command Reference Guide

Anything in blue is information that you give the computer, such as a set_name that you make up for an
original dataset or the name of an uploaded dataset, or a var_name, which is the name of the variable
from a specific dataset that you need to use. Anything in red is just an example number to represent
what you might input if you were making your own dataset.

Cat_var_name is the name of a categorical variable, while quant_var_name is the name of a quantitative
variable. If you see something like x_var or y_var, those are the names of the variables that you want on
the x and y axes respectively.

Basics:
Entering a new dataset— set_name=c(16,14,13,13,14)
Graphs:
Histograms— hist(quant_var_name)
Boxplots— boxplot(quant_var_name)
Side-by-Side Boxplots— boxplot(y_var_name ~ x_var_name)
Bar Chart— barchart(cat_var_name)
Scatterplot— plot(y_var_name ~ x_var_name)
Numerical Descriptive Stats For One or Two Quantitative Variables:
Mean— mean(quant_var_name)
Median— median(quant_var_name)
Range— range(quant_var_name)
Five Number Summary— fivenum(quant_var_name)
Standard Deviation— sd(quant_var_name)
Tally— tally(cat_var_name)
Percentile— quantile(quant_var_name, 0.1)
Correlation Coefficient— cor(y_var_name ~ x_var_name)
cor(y_var_name, x_var_name)
Linear Model— model_name=lm(y_var_name ~ x_var_name)
Abline— abline(model_name)
Numerical Descriptive Stats For One Quantitative Variable and One Categorical Variable:
Mean— mean(quant_var_name ~ cat_var_name)
Median— median(quant_var_name ~ cat_var_name)
Range— range(quant_var_name ~ cat_var_name)
Five Number Summary— fivenum(quant_var_name[cat_var_name == “Name of Sub-category”])
Standard Deviation— sd(quant_var_name ~ cat_var_name)

Probability with a Normal Distribution


Probability— pnorm(cutoff-value, mean = 45, sd = 5)
pnorm calculates the area to the left of the cutoff value
Cut-off Value— qnorm(area, mean = 45, sd = 5)
qnorm calculates the cutoff value, where the area to the left is
equal to the input area

You might also like