06 Lesson 2 Supplement

Supplement for Lesson-2

by A. Mani & Anne Laure Buisson

Useful Commands:

A is a data frame in the following.

A$colname - extracts column with name ''colname'' use:

A[,i] - extracts the ith column

A[i,] - extracts the ith row

A[[i,j]] - for ij th element

What is A[i,j]?

A[1:3,2] - extract rows 1:3 of column 2

Other Useful Commands:

edit(A) - for editing A

head(A) - extracts the first six rows of A.

tail (A) - extracts the last six rows of A.

names(A) - lists all column names