R Cheat Sheets Page 2

ADVERTISEMENT

Apply
apply(data, axis, fun)
Apply the function fun to data along axis
lapply(data, fun)
Apply the function fun to the list or vector data
rapply(data, fun, how)
Apply the function fun to data depending on the value of how
For a great introduction to using apply see
this
article.
I/O
read.table(“filename”, sep=”,”)
Reads information in from file with a variable delimiter
read.csv()
Read csv file into dataframe
fromJSON()
Read JSON formatted file or string into a list
xmlTreeParse()
Read XML formatted file or string into a list
write.csv()
Writes a dataframe or matrix (or tries to convert input to one) and writes to csv
Structures
data.frame(…)
Takes multiple variables with the same number of rows and creates a dataframe
list(name=var)
R’s implementation of a hash, takes multiple variables or variable tag pairs
ts(data, frequency)
Creates a regularly spaced time series object
Time Series
Time Series Classes
ts(data, frequency)
From R base, handles regularly spaced time series
zoo(data, index)
Part of the zoo package, handles irregularily spaced data using arbitrary time
date classes
xts(data, index)
Modification to zoo, gives more power to selecting date subsets
tis()
Uses POSIXct time stamps
irts()
From the package tseries and uses POSIXct time stamps
timeSeries()
Uses timeDate time stamps
Tests
adf.test
Computes the Augmented Dickey-Fuller test for the null that the series
has a unit root
jarque.bera.test
Tests the null of normaility for the series using the Jarque-Bera test statistics
kpss.test
Computes the KPSS test for the null that the series is level or trend stationary
po.test
Computes the Phillips-Ouliaris test for the null that the series in not cointegrated
pp.test
Computes the Phillips-Perron test for the null that the series has a unit root
runs.test
Computes the runs test for randomness of the binary series
terasvirta.test
Generically computes Teraesvirta’s neural network test for neglected
nonlinearity for the time series
white.test
Generically computes the White neural network test for neglected
nonlinearity for the time series
box.test
Compute the Box-Pierce or Ljung-Box test statistics for examining the null of independence
in a given series
2

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 4