0% found this document useful (0 votes)
7 views7 pages

R Programming: List Manipulation Basics

The document discusses the creation and manipulation of lists in programming, including accessing elements, indexing methods, and applying functions to list items. It provides examples of syntax for creating lists, retrieving elements, and using functions like 'lapply' and 'sapply' to perform operations on list elements. Additionally, it touches on data types and the structure of lists, emphasizing their versatility in storing various data forms.

Uploaded by

nanisai3108
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

R Programming: List Manipulation Basics

The document discusses the creation and manipulation of lists in programming, including accessing elements, indexing methods, and applying functions to list items. It provides examples of syntax for creating lists, retrieving elements, and using functions like 'lapply' and 'sapply' to perform operations on list elements. Additionally, it touches on data types and the structure of lists, emphasizing their versatility in storing various data forms.

Uploaded by

nanisai3108
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

nt-1l

ronsistna pt en
odcd
st is a0 Genrlc occt
St

It iS Creatcd
uing tist

one- dimensional.
) unct?

ioad ot 0
- Tndcing
list 5tat ftn

- Acce

nie canalio
EL Crang alist
elemcnls Lunqf
ciecut

c
a vetist LhngVccto

i0 R,Which has
numeric Qlue,
)

SHinq, aic valute P xa matnit

m-tiSt L-
ttst (
c(o, 20,0).
Tum-veetor
Sti-value = Helloe.
to4cal-Value 1RUE

Marin tualle - namz ll,n7ouD"9)

print (myist )
print (m-list s sh-Value)
Dint (my{ist num-Uel) Ci) Cto, 20,30)

pinu Lmy -ist $ toial valuc) tocal (atue e

pintt my -ist mait-Vaus) Ct) TVE

(1,)
C2,)
inR sIores ditterent data typa (inclcing
List

Ioumbers , chacckeiS VecHSs mahile, hnnq Che)


Gh oioLide TO acCeKI thye ctemenk k prouider

2 indeinq methodia
1) stogle sauaed brackek L]
)doubie sauarecd bracket )
i) dolor hon opeiator 11Ay
indeuirn 1s oSecl to als the Spciie element Dr

componenk in the tist

) singe sauared bracket CU

-Retuns a ka Sublist

EVeD it Ou Seteck one element. the ocu remains


alist

Sntat

LiSt-name [inde vecto

EU
myist 1st (a-10,b= 90:12, c = ^heilD')

my list[1)

ReUt i8 SHUatist contatng 1 element


ubc 594Qred bachet
[
io tthc tist, nOtaist
th actunt elcment
Retuns thy (otcnt
LOor to eract
tSe this Lehen Ou

dliecty

Syntax
[C*component
name)
ist naMe
"hcllo ')
b- 20.29,C-
l-11st (a-10,
m-li&t

my tist L[11]

putput

It en4 prink a wement not Q list

-Sed

W0k
toeubaet the eements b

Like [{J,bur uh en Ou
nume
Dnlt knous themme

1.1tTehuru the elermer ftse, rOt auublis} -

Syntax

tist-name componcot-nane

mylist 6a

output

Same a myust (r"l


3 Student -( I1st

mame" Akshitha

YOlND l0,
mares A8

Stuclent 3 qiade "A"


Student T0Ilno-NDLL

pint (S tudent

$ name
t1] " ALshitha
maf

qrade
n E,tapply) and sappyU are commoni

to00pd a oHon to each element ot o he

terni

Meant)
tt s Sed to calcuuate the aithe meHC averaqtoE
the data

Lappl

laPpa€)Stand to list Appi

3 It appies a tuncHo0 to the tach element the

5applU

6appt t) Stants tor Stmpliicd istl )


it bies to simplity the
Same as e tapply) bt

mmylist- 11St(

a c(t 1,3.
b-cl0,90,30),

sesUt. tapy tappl4 (myiUtmean)

pint (Tslt tapplcy)


r1)20

C1] 10

wing sapply:

Sanx d4 tappl but art to lhes


74u-SaPpl - Sappl (mammy lis -mean)
Ptint ult( -sappl)

owput

0.5 500 to.0


5DIds -cl"R',s"'fun" " and", . R S", pouel eu)

-unique lwordy
conOYcance e-iStC)

for Cnl inuniaue -nords) E


ConcbdancefwJ) -Inlhtoht uoodl 1w)

Cat ("concordance (ulord positons J: \o)

pint conca dane)

$ and
C13 4

(1)|5
.is
C4) G

You might also like