! -- End Code For Single Click -->Skip to Main Content
R commands are case-sensitive.
# comment follows.
<- or = is assignment operator.
c is used to concatenate.
demo() is used to see what R can do.
ls() lists existng objects in R.
help() displays the help manual for a command.
read.table() reads text files.
read.csv() reads comma-separated files.
read.dta() reads Stata (.dta) data files.
read.fwf() reads fixed format text files.
str() gets structure of a dataset.
save() data in an R data file.
load() reads data in an R data file.
library() loads an installed package.
rm() removes objects.
class() lists the type of an object.
mean() calculates the mean.
median() calculates the median.
sd() calculates the standard deviation.
cor() calculates correlations.
summary() is a generic function which provides a summary results of an object.
by() is used to apply a function to a data frame split by factors.
tapply() is used to apply a function to each cell of an array.
hist() is used to draw a histogram plot.
boxplot() is used to draw a box plot.
table() is used to generate a frequency table.
rbind() combines rows of data.
cbine() combines columns of data.
merge() is used to match-merge two data frames.
t.test() can conduct one sample, two sample and paired t-tests.
lm() fits a lienar model (regression).
anova() extracts the anova table from a lm object.
glm() is used for generalized lienar models.
wilcox.test() is a non-parametric analog to the indepndent two-sample t-test.
kruskal.test() is a non-parametric analog to the one-way anova.
This guide has a user friendly interface.