Professional Documents
Culture Documents
A \ Rfor Beginners
V' . uch as SP SS (St ati sti cal Pa cka
R di ffers fro m other Wmd?w . le pro gra ms s d ti d
ge for th So cia l
. .
s sty and cli ck op tio ns for e
t~~ pre e me statistic~\ pro
.
Sclences ) tl1at uses menus with cho ose 'd tet·mi nal fac1hty wh ere all the wo rk is co
ces ses .
Instead. R has the R Co nso \e fea_tur ·\ t prov1 es a mp let ed
e t ia
. d st,,\e or tex t fun ctio
m com man ns. k e pra cti ce to lea rn. Th e use rs,
The R language, a\th ough not ve1 d. fficult ta es som
u ; •
•
wh o are
~ t a~or ) or oth er sim ila r too ls ,
familiar with SPSS. MATLAB mo stl y use R sof tw are
(M atn x Labor . y 'f na
package as a statist . . ~ xec nd s. It pro vid es a tro ub le- fre
~
l ca\ too\ ior easy e ut1.0n. o com l
t
r dea . 1 d
e and
. .
e\Tor-free enviro nm ent compar d c- lin g wi th co mp ex ata mm
e to o th ei. stat1st1cal too s io mg
concepts like Principal Compone
nt Analysis. .
R is an open source and free to d \ d pro gra mm ing lang uag e dis trib ute d un de r the GNU
own oa_ . Th e bas e sys tem an d pa ck ag
(GNU"s No t Unix) and GPL (Ge es are
nera\ Public L1c~nc~) ter ms bas
parts of R. Th e R Development e s ste m dis tri bu tio n of R.
Core Team ma mt am s the Th e
packages are authored and preser yF the off ici al ho me pa ge
ved by a large group of vol unt
of R project, the users can access eer s. rom . th R sys
the main source of data abo ut R. tem
·
itse lf add-on packaoes manuals doc All res ou rce s, 1.e.~ e
umentatio· ns,
' ::, ' ' etc., are access1'bl e fro m the off ici al ho me pa ge .
:1 ~ t L, 1 1 . 1--, l c k ,1 q P .s
" J •
( .s an ci w 1 r:
h ")
F,
I 1
ter att ac hi n g th e pa c ka ge us in g li br ar y
() fu nc tio n by
ali ty is a va il ab le af
Th e p,1(1'.1!-!C fi 1n cti on
g ive n be low.
(c1Jfl1 ,\ in g th e cn m nw nd
di ng
C he ck Your U nd er st an
ides
1. W ha t is a pa ck ag
e?
pl es an d do cu m en ta tio n. R la ng ua ge prov
am
lle cti on of fu nc tio ns , ex e co nt ai ns ot he r packag
es
An s. A pa ck ag e is a co ns . Th e ba se pa ck ag
ul fo r m an y ap pl ica tio
di ffe re nt pa ck ag es us ef
d gr ap hi cs .
su ch as uti Js , sta ts, an
ge so ftw ar e?
tw o m aj or pa rt s of th e R la ng ua ge software .
2. W ha t ar e th e
es ar e th e tw o m aj or pa rts of th e R la ng ua
an d ad d- on pa ck ag se " an d ot he r ne ce ss ar
y functions.
An s. Th e ba se sy ste m po rta nt pa ck ag e " ba
s th e m os t im
Th e ba se sy ste m co nt ain
by to pi c?
us er br ow se di ffe re nt pa ck ag es th e users can
3. H ow ca n a
ov id es th e CR AN Ta sk Vi ew s fro m wh ic h
ite of C RA N pr
An s. Th e of fic ial we bs c a nd do wn lo ad th em as pe r th ei r
ne e ds .
es by to pi
ea sil y br ow se pa ck ag l website of
d in sta ll a pa ck ag e "x yz " fr om th e of fic ia
wn lo ad an
4. H ow ca n a use r do
nu na nd
CR AN ?
ck ag e "x yz '', th e us e r ca n us e th e co
~. Tu downloc:1d
an d in s tall a pa th e R la ng ua ge .
of
An
es ~x yz ") wh ich is a bu ill -in co m m an d
j ~ J-J . f.Jdr_· ~
Jr a~
__ __
Q Rfor Beginners
1.3.1 Simple Common Op
erators
Like oth er programming
languages , R also has sim
logic3\. etc. 11~ operators ple operators Such as ari
th .
operators.
can be used 2as described in Table 1. .
Also, Figure G::· ;elational,
? ains these
TABLE 1.2 Examples of operators with their outputs
Ol!erator ExamJ!le with 0!!,!PUt
# Subtraction > 4 - 3
(11 1
# Multiplication > 4 * 3
(11 12
# Division > 4 I 3
(11 1. 33 33 33
# Exponential > 4 A 3
(11 64
Rw (64·bil)
ta.-·r:oo Y- i!;,c t,d,g e -
·~
~ ~ il l! \
> 4- 3
[11 1
> 4/ 3
I [l) 1. 333 333
> 4•4
[ 11 16
> 4 ~3
, [l) 64
> 4\3
. ~r, or: une xpe cte
d inp ut in "41 3"
I > (4 - 3) * 2
[ 1] 2
I >sink( "record.lis")
I >sink ()
1.5.1 NA
The special value. "NA" stands for "not available". These values are used to signify missing values
. . .. to text
. R he or she accesses a value that 1s not availab le. R loads it in L
m • The user sees NA when
the NVL
values to represent the missing values or loads data from the databases for replacing
Rfor Beginners . . _
. I . I , ,111der.\Cnn' r'/l((racter ,s useJ Jor ulloca1;
. IR 1md '" S-P "" · t I< . • I i on, h11
In som< ' ,1/ikr r <"n 10 11 ' 0 · . , . ( R / /c!l n', this 1s us4 11 to 1(110 W so that when , ' th1
. . . I hi , 11 /'Cc'C l1f releo' t ., o · . J ou fr
/, 17<1 //IJJf!.c' l" <Tl,, < ' / ' . • , ·Jll f i1'11 r if docs not wot k. } i,
' C ; , , , , , ,·( d (· 117 R 1'(HI (',111 , l ,(!.IJ/( I .
11' ( •, - . ' .
, h · t ,,·oi·ki·110 director)'· In R, fun ction s, li sts, vectors, etc., are th e exam ples of
t
() I f Cll!Tc?ll O
0l.,_iects.
., How can one assion value to the objects?
Ans. The yaJue to the o~ects of R is assigned using left arrow with a hyphen (<- ) or right arro1
with a hyphen (- >). Although the 'equal to' operator may also be used but it is not truste
as it generates e1rnrs during programming.
1. 7 FUNCTIONS
Functions are tb e base of any programming language. The user can get only so far by typing i
calculations. Most of the statistical analyses require a number of functions and R language provide
the required fun ctions. R is not so much a statistical package in the traditional sense as Mini tab is
but it is really a programming language designed to be good for carrying out statistical analyses.
It has a variety of short readymade pieces of code that can carry out tasks, like managing use
data. These readymade pieces of codes are called functions. Along with this, functions can perforn
complex mathematical operations, draw graphs, and carry out statistical analyses ranging.
ln other words, a fu nction is a group of statements used to perform a particular task. Ead
fu nction name ends in a pair of brackets and for many of the more straightfonvard functiom
us.er needs to just type in the name of the function and put the name of the object. Many built-ir
fu nctions are avai lable in R. Some examples of built-in functions are given in Table 1.3 along witr
lheir outpu ts. -
5011 le
kel'. 110i11ts related to .f1111L'tirms
• The user c:111 c11T~ nut cakulations 1ha1 arc more complex hy rrwking th e argument of 1he
1
runrt il111 phc bil bct\\'een the bra cket s) a calculation it self'. For ex ampl e. the fo ll owin g
Cl)111111 :ltld " ill return the sine of 15 plus th e va lu e or the object " ,rn ::w/'.~ r ".
I 'sin (l5+n ns we r )
• The usn l'an use brackets within the function 's brackets to make sure that co mpli cated
l'alculations are carried out in a correct order. The following command will return th e va lue
of ·e· rai sed to power the value ofx multiplied by 3, raised to power 1/3.
• The user can use functions in creating new objects. The following command creates an object
called P that has a value of 1 divided by the square root of value of object y.
Most R functions have default values specified for most of their arguments, and if nothin~ is
specified, the function will just use the default value. If we do not define the number of di crits~for
r oun d (), it will assume that the number is rounded off to no decimal places. ~
I > round(1 6 . 77 84)
~ Rfor Beginn ers
5. In other words, it ca lcu lat es
.I [1) 17 •
r111,clfOl1,\
.
: 5 to base 2.
011
, , ,r:amJ'/cs .,.culatc s the, log
arith111 ° 11
1111ents are p
. le the ann at the arguments I
~ I
rec isely spec1 simply by their
11ean
nJ
>s i gn if( pi , 4)
[l] 3 . 142
function?
3. What is the use of sig ni f ()
en value (first argument) to th 0
.
rou nds off the giv
Ans. The sig ni f () fun ctio n
le, the com ma nd s i . e oIVen nu mb er of
ent ). Fo r exa mp gn if( 2 3 , 1 ) ret ur ns
significant digits (second argum ·
2 as the output .
ction and ab s() function?
4. What is the use of ro un d( ) fun d
n function in R languag e tl 1~t
-.)
" 1< un s of f h giv .
Ans. The rou nd () functio.n is a. built-i . fun cti on re t e en v ·
. th e dec ima l place. Th e ab s ()
according to value giv en 111 tun1s the ab alu e
value of any given number. Solute
~
A Short Introduction to R GJ
SIMPLE MANIPULATIONS-NUMBERS AND VECTORS
1.8
I,. ·s q~ction. we will di scuss vectors and arithmeti c operati ons on vectors' log ical vectors, and
111 tll
, ., cter n ~ctors.
~ I1-1 1'1
1.8.1 Vectors
A rector is a fundamental data ty pe of R language. R operates on named data structures such as
;1t1tneric vectors. A vector may be defined as a single entity consisting of an ordered collection
of numbers. ln R, c () function is mostly used to create vectors. For example, to set up a vector
named p, consisting of four numbers, namely l 1.5, 6.8, 5.2, and 25. 8, the following R commands
are used. This is an assignment declaration using function c () and it produces the following output.
I >p
[l] 11 . 5 6.8 5 . 2 25 . 8
Similarly, assignments are also possible through the right side operator in R. Therefore, the same
assignment could be completed using the following command that produces the same result.
In this context, c ( ).can take a random number of vector arguments. The value of c ( ) is a vector
obtained by concatenating its arguments end to end.
The assignment operator(<-) is placed strictly side-by-side to the object that receives the value
of the expression. In most situations, the '=' operator can be used as a substitute.
If an expression is used as an absolute command, the value is printed and lost. Therefore, the
following command is used such that the reciprocals of the four values are printed at the terminal
as shown (the value of p , of course, remains unaffected).
I > 1/p
[l] 0 . 0869 5 652 0.14705882 0.19 2 30769 0 .0 38 75 969
The following assignment command creates a vector y with 9 entries consisting of two copies of
p with a zero in the middle place.
I
> y <- c (p, 0 ' p)
> y
[ 1] 11. 5 6.8 5. 2 2 5. 8 0.0 11. 5 6.8 5.2 25 . 8
I
~ as s_ i_g n ( " y" ,
" y
[l] 11 . 5 G. 8 5 . 2 25 . 8
0
1. 8.1. 2 F1111ctio11
ve ct ;o r () Th e fiun cti on tak es twon d
ec ifi ed len gth an d typ e. th
r of sp
The ve cto r () run crion
also creates a ve cto c, co mp lex , log ica l , etc
.) an d e se c
en t is the typ e (n um eri
arg um en ts.of which, the fir st arg um
e.
argum ent de fin es the siz
", 6 )
> ve ct or (" nu me r i c
[ l] 0 0 0 0 0 0
>
>
er i c ", 4)
> p <- v ec to r( "n um
> p
[l ] 0 0 0 0
>p <- 4 .5
I > q< - 6 .2 5
>p+ q
[1 ] 10 . 75
> 1: 20
20
[l] l 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
> 2*1:10
[l] 2 4 6 8 10 12 14 16 18 20
> 10 : 1
[1] 10 9 8 7 6 5 4 3 2 1
> I
I >seq(l , 20)
[l) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Arguments can also be given in named form in which the order of their appearance is immaterial.
The first two arguments can be named as (fr om=va lue) and (to=va lue). Thus, seq ( 1, 1 O) :
seq ( f rom=l, to=l O) and seq (t o=l O, f rom=l) are all same as 1: 10.
Thenexttwoargumentstoseq() maybenamedas (by=value) and (length=value ) thal
specify the step size and the corresponding length of the sequence, respectively. If neither is given
then? The default value 1 is presumed. For example, the following command 0oenerates as
equenc(
from 2 to 3 using a step of .2.
I
>seq (2, 3 , by=.2) - > p
> p
[1] 2 .0 2.2 2 .4 2.6 2 . 8 3.0
Similarly, the following command also generates the same vector in pl and Fio
. . . . bl
1t m R environment as given e ow:
c Ure 1·8 eXp 1ain:
I
> pl<- seq(length=6, from=2, by=.2)
> pl
[1] 2 . 0 2 . 2 2 .4 2 .6 2.8 3 .0
A Short Introduction to R fJ)
ul (64-bit)
fdil 'fr"" fllisc f• ck,g,s Window, li•lp
-.■ oil~
The fifth argument can be named along=vector and is usually used as the only argument to
create the sequence 1, 2, ... , length (vector), or an empty series if the vector is empty.
I > p2
[1) 2 .0 2.2 2.4 2.6 2.8 3.0 2.0 2.2 2.4 2.6 2.8 3.0 2. 0 2 . 2 2 . 4
2 .6 2.8 3.0
Another useful version of the command is given below in which each element of p is repeated
three times before moving on to the next.
I > p3
[1 ] 2.0 2.0 2.0 2.2 2.2 2.2 2.4 2.4 2.4 2.6 2.6 2.6 2 . 8 2 . 8 2 . 8
3 .0 3.0 3.0
I
.
G) R for Beginners
are indi cate d by
ter Vector . I beJs ; whe re requ ired , t~ey
used in R as plot a mpl e "H ell o " is a char acte r .stri ng.
1.8.5 Charac I
0111 mon Y
.
tes For exabl (" ), or smg le
(')
quo tes. U s mg the
. bl e quo ·
. ·ter vectors ate c ~ d by dou I . dou e
Cl131a1..: . d tine . ram or con sole . Cha ract er vect ors
ts e d ing eith er. mat
uence of charactepene e 1111g
.· ·e trate us . rint ed in a pro g
a seq ithout quotes, it ,s p .
Characte r stt mgs a1 .
funct10n.
double quotes, or son~ ettn :e:: tor using the c ()
can be concatenated mto
d con cate nate s them one by one
() Function gs
pas te . . ndo m num ber of argu men t~ an . t med into cha ract er strin
J.8.5.1 nts give n 1s u
f t'on1 obtams a ta
nbe r amo ng the argu me d f. It div ided in the resu lt by
The pa ste () unc _ . t d The argu men ts are by e au
into the character stnngs. An~ nut
in an obvious way in which tt was prm e .
a single blank character. s into a cha ract er vect or.
The follo wing set of comman d tum P
= \\If)
>i< - 10 If
i)
i
> p aste ("T he val ue o f
1 O"
[l] "Th e v alu e of i =
----
e1 vec tor.
-- -- -- -
A Short fntrocluct ion tn R
[ , 1] [ , 2] l, 3J
[1, l 1 4 7
[ ::'. I l 2 5 8
[3 , l 3 6 9
Few examples of the matrix function are explained in Figure 1.9 given below.
4t kwi6o4-h,I)
' r- t• ► »-< fKbte ...... ~
~l!Iii2lij]l!J
r o w= T )
_· :--: . - m,i tri x ( l : 9 , nr o w'-=3 , by
.
1 ' h 1 ' ,c; n i' :· ( x ) "-- - LET TER S [ ]_ : 3 J
·, .~
i, 1J [ , 2] [, 3]
j 2 3
p '~ 5 6
C 7 8 9
t= Tr an spo se of a ma tri x is :
)
>r bin d (P= l : 4 , Q=5 : 8 , R=9 :l2
[ , l] [, 2 ] [, 3 ] [,4 ]
P 1 2 3 4 Acc. No .... ...J.g J .3 3 ...
Q
P
5
9 10
6
11
7
12
8
[ , 1) l , 2 l I, 3 l
')
A l L. 3
B 4 5 6
C 7 8 9
'> p
[ , 1l [, 2] [, 3 ]
[1' ] 1 4 7
[2 , l 2 5 8
[ 3, l 3 6 9
> p*x
[ , 1 ] [ , 2] [, 3 l
[1 , l 1 8 21
[2 ' ] 8 25 48
[3, l 21 48 81
>ar <- array(l:20,dim = c(2),dimnames li st(c( " Ageu, " Names ")))
>a r
Age Names
1 2
dif feren,
1.10 FACTORS ta,
In sta tis tic al sdatum
.
. . . lue s. . las or stage
~ . . va lue s int o sm all er va 1a 1 c '. .
A fac tor is ba sic all y the d1 v1s 1011 of .large . . . n of data, sue h as .soc nu me nc co de , su d
1sw
. . . les are us ed to spe cif y som e subd1v · pu t us mg a
an ab
ca teg ori ca·l ' . tan ne r sta ge of pu be rty, etc. Usually, these are m
· . ary dia gn os is,
pr im . ·de a fou r-l ev el fac tor
co ns istJ
fac tor s in R. ter ve cto r of len gth t
Ya ria ble s are ind ica ted as lev els for co mp act ne ss. On th e ms i h,
ara c
r d (b) a c tha t ex pla ins the co nc ep
Th e ex pre ssi on facto r has fou een 1 an
d 4
, _an
- . r of int eg ers be tw 1
ot two_ ite ms : (a) a ve cto the four lev els . Given below is an ex am p e
en clo sm g str ing s cla rify ing
of a factor.
, 1, 2)
>u n iq ue < - c ( 0 , 4 ,1
ni qu e, le ve ls= 0: 3) ", "l ar ge ")
> fu ni qu e< - fa ct or (u ne
d'
,,, " mo r e" , "m e iu m
~ <- c( "n o
> le ve l s( fu ni qu e )
>£ un iq u e mo re me diu m
[l] no ne <NA> mo re
me diu m la rg e
Le v e ls : -no ne mo re
r "u ni qu e"
the fir st co mm an d lin e ge ne rat es a nu me ric ve cto
In the ex am ple giv en ab
ov e, ca l va ria ble , a fac tor fu ni qu
E
tre at thi s as a ca teg ori
of five values. To tc
en co din g the un iqu e levels tor . Th is is ca lle d wi th on e arg um en t in ad dit ion
the function fac thin
is cre ate d from it by using tha t the inp ut co din g ex erc ise s the va lue s 0- 3. In
: 3 that specif y ine d i1
un iqu e, na me ly lev els =O r ind ica ted ch ara cte r str ing s. Th es e are ex pla
nged to the fou
lin e, the lev el na me s are cha
fig ur e J. JO giv en below.
t4lf f' Gu1 ({A L,tJ
- tJdp
t .. £de 'f,o,~ Id<>< /,<i"9 "'
··~
t~Ltt 1111t1t1o1■ 101 /j] [!]
1 hl' 1111
• 1 • \ H)11
L
,i ' • 11 I 1Jll' I 11 ,,,
I ',,._
fa ctorc; int<) num herc., In the fol\o\,\, mg
() U)l1 V t:rt <;, e"<a mpl e.
.
• ,
11 1
, 1~ cn n, c1 tcd mto ,1 num eric al coclm!!
r:-il' IIW . ·
a~ num er" h " \ 4 r hc n rJCT in:Jl inpu t cod ing
. (,f num hT~ 0 J Im!-- rli ~"PPC An~cl f rom th F-
111 \ Lfll)' - e f ,n 1 ' !' !' foct or.
I -,
i1l 1 NA ~: ?
lc-\' c l ~ (fu niq u o )
l 1 l " n ~') n e "
3
"m o re "
1.11 LISTS
A list is a coll ection of valu es . It is som etim
es valu able to mer ge a \.:ol kct ion of l_)bic-~l::;
co mbined obje ct. Thi s bec ome s poss ible in into ..1 \m -.t:-r
R lang uag e usin g lists . The use r cm- buil
it.., elements with the li st func tion . d ..1 fo,t t~m
A.., an exa mpl e. con side r a set of data plac ed
in two vc~tors A nnd B . To n\cr'=!~ th~~~ mJ.i
vectors into a li st, the user may use the list \ iJu,ll
fun~tion ns foll ows : -
.,, A <' - r, ( 7 g OO , ., 0 <,30 , 2 G8 0 , 1
) l '/ l) , I. ) 3 0 \) I
,1 8 / ~) , 1:.,:' \' ~ , ; "-' t I'
.,, I~ r ( ', <J CJ U , '/'/.. ·/ () , IJ B HO , ~' _, q \.) , 1 ..... , C' .., ~ , - ~
<' -
d~ •I q ~
"'
... • - ' •
.... I
'
, .\ \_) I \J . ~' l t,,,. I:.' ,1,, .... , ., l ' , ·'. ., ~ ~ • \
,., ·1· ,.J t,d ] ✓- I i :; I (li 1· ! 1> 1 1· /\ , dl l, •t l\}
..- TcJt 11 J
R for BeRinners
I
< •
1r "r, ;' hH 0 ')[70 6300 ~87S Ci508 7010 6535 6250 6790
• 4. '-
Thl' l'lrml'n h nf :i li~t arc named according to the argu~ent_names _utilis~d in the list. N
L'lcnw111, arl' 1.' >.tractcd usi ng the fo llow ing command which 1s explarned m Figure I.I a~~
1 giver
hdc,w :
I . ... ...
,.
:, · •:: ~: tefore
· ~· ~JOO 7090 26 80 5170 6300 4875 65 08 7010 6535 6250 679Q
~ .. i.... 11--P-<br-lll"d-<t,,i,
~~ti~
SaftE:r
[ 1 J 5s,90 7270 4280 5290 5849
Note Marry of R :S· built-in functions calculate more than a single vector of values and return ;
their results in the form of a list. '
Generally, the columns are named, and at times, the rows too are named. In a data frame , the
columns are called variables. Given below is a simple example of a data frame showing the top
mobile companies. Along with this, data frames are applied as lists with a class data . frame . The
explanation of these commands in R environment is given in Figure 1.12.
>typeof(Companies)
[l] "list"
> class(Companies)
[l] "data.frame"
Note The same processes may be used to refer to the items in lists and data frames. For
example, to extract the rank column from this data frame, the expression Companies $ra nk
can be used. The further chapters will discuss lists and data frames in detail.
SUMMARY
• R is a programming language specially • The base system and a collection of
developed for statistical data analysis user contributed add-on packages are
and graphical representation . the two important parts of R system for
• R is a/so a software package that statistical computing.
contains different tools. These tools • A package is a collection of functions,
provide different types of facilities for examples, and documentation. The
data manipulation, data calculation, and functionality of a. package is focused
data storages along with the graphics on a special statistical methodology.
display facilities. • The official website of CRAN
• R language can be used in any field that (Comprehensive R Archive Network)
requires a large amount of data storage provides 8696 packages for different
and data analysis. Diverse business purposes.
fields like finance, marketing, supply • R is an interpreted programming
I
erous
chain, bioscience, etc ., use R language. language and supports nu rn
A Short In t roduc t ion t o R e
f unctio ns and co mm and s. Du e t o t h is, • M atrices and arrays are c haracte rised as
it is also ca ll ed fu nc t ion and c omm and - vecto r s with dimensions in R lan gu ag e .
line based pr o gra mming langu age. Th e d irn ( ) f un ctio n sets the d imen si o n
• R language is c as e se nsitive as are the att rib ute o f a m at rix .
majority of UNIX -b ased p ackages . For • In R lan g ua ge , a facto r is no th ing
example , ' A ' and ' a ' are different but a vector obj ect t h at conta ins th e
symb o ls and both would refer to group of elements of othe r v ectors of
di ss imilar variables . same length . It can be eith e r ordered
• R langua ge provides some values such or unordered . The factor () fu n ct io n
as NA , Inf , and - Inf for representing creates a fac t or .
so m e special values such as infinite • In R language, list is also an object t hat
v alue o r missing value . contains ordered collecti o n of obj ects
• A v ector is a data structure that stores or components. The compo n ents may
similar or dissimilar data elements. be strings, numbers , log ica l v a lu e s ,
complex numbers, or matrices .
• In R language , c ( ) function is
a concatenation function that • A data frame is a natura l w ay to
concatenates the values in a list, or in represent these datasets in R. A dat a
other words, creates a vector. frame represents a table of data .
KEV TER M S