q(),
help(),
etc.
data.frame(),
fix(),
read.table().
ls(),
summary(),
rm().
x$column,
x[[n]],
x[,n],
x[n,],
attach(),
detach(),
search().
mean(),
sd(),
var().
tapply(),
t(),
transform(),
aggregate(),
as.factor(),
is.factor(),
cut().
plot(),
barplot(),
hist(),
interaction.plot(),
etc.
aov()
and
lm().
function() {}.
tai.txt
td <- read.table('tai.txt', header=T)
summary(td)
attach(td)
tapply(response, list(native, nasal), mean)
plot(response ~ nasal)
summary(aov(response ~ native * nasal +
Error(subject/nasal)))
summary(aov(response ~ native * nasal +
Error(item/native)))
chisq.test() — χ2 test.
| total number of words | 1,026,595 |
|---|---|
| words beginning with [mn] | 62,415 |
| words beginning with [bd] | 77,262 |
chisq.test(c(62415, 77262))
t.test() — Student's t-test.
t.test(response ~ nasal, data=td, subset=td$native=='no')
R CMD INSTALL /path/to/pkg_version.tar.gz
install.packages(c('packagename.tar.gz'))
languageR.
library(packagename) — loading packages.
library(lme4) library(languageR)
data(name, package='somepackage') — reads a
dataset from some package.
corpora — Statistics for corpus linguists.
languageR — Package for Harald Baayen's
book on statistics for linguists.
matlab — MATLAB emulation package.
neural — Neural Networks.
neuralnet — Training of neural networks.
Rcmdr — R Commander. A platform-independent
basic-statistics GUI (graphical user interface) for R.
sound — Basic functions for dealing with
wav files and sound samples.
tm — Text mining package.
xtable — Export tables to LaTeX or HTML.
zipfR — Statistical models for word
frequency distributions.
lmer() — function from the lme4
package to calculate a linear mixed effects model.
pvals.fnc() — function from the
languageR package to calculate p-values from
a linear mixed effects model.
summary(lmer(response ~ size * sonority + (1|subject) + (1|item), sn)) pvals.fnc(lmer(response ~ size * sonority + (1|subject) + (1|item), sn))$fixed
postscript() — export a plot as postscript.
postscript('filename.ps')
plot(age ~ weight, data=g)
dev.off()
xtable() — converts an R object into something
that can be printed as LaTeX or as HTML.
library(xtable) g.lm <- lm(age ~ weight) print(xtable(g.lm)) print(xtable(g.lm), type='HTML')
R CMD Sweave filename.Rnw — converts a sweave
file into a LaTeX file. For example:
swtest.Rnw
can be converted to
swtest.pdf.
R CMD Sweave swtest.Rnw latex swtest latex swtest dvipdf swtest