0% found this document useful (0 votes)
26 views11 pages

R Notes

R programming

Uploaded by

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

R Notes

R programming

Uploaded by

saha.pritam939
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
a R TRdovial. “sin Reprombt we cam do amy Ma addition SubStraction +> PA ered butting dhe operotens ('+!,\— +8 ed) 9 aBStan votlable We use Rooke eee SM combine Yolues into a vector WF vse +Moadd Comments th the: R--Senipt ( we ve © Jo instr pockaged } ie R, We Ue "tobell sstesieat +@ get the documentation about aang fumedion in R, O& vee “het 0", » IP, oeone mS Sune about the ame of funchion , We Cor perfoan a fuzzy iSeanele ae ‘Strobes 5} Sunchion. Tere one S ‘Basra dota’ ao in Real: \-umestic 2. Integer ‘9s Compe | Ae Logeel | We abat oberedion like 7 the rum bexs amd » (ex: X=3) : The fumetion ‘C the Symbol “a. 5. ¢haacter . Biiimenie *Dectmal sole ore ee th R. (@x- x2 10-5) ¥ Am assigned -Velue we vse cles $2, Function. Seda [ classe). re = ices ment en PS Fictherem de, even if 2s o3Sign am inboger A oie ee : sh betng Soned of co, Tuam ente, velise: 4 in R- Ck=1) | of the o8Sig med ee. i$ imbegen om To} cam be con foamed sg! ig. Jeleg ie aa, he eee >, TRUE| Integer - tie th onder te czeot] am inte gon vaniclble } ‘mR oe use of integer fumetion . find vente 3. ae Function. aes cam be 0%Sumed that tho "Len este ao an ineqon, ©)! i, Ys os. sieragen (3) Le: using “Ls Suffix we cam also declow class(¥)” Bakeagn Et MPO clo bot “inkegen" 6. Tnkegen (3) ae TRUE } : fe. chunacbes “py chanocla’ Laker; * USing. of-tntoger fumelion we cam coment a OY declmol String into am inte i es integer (3: 14) sil Tategete (5 oD ob. imlergen ( Hi), NA ] ( os. Tnegen (TRUE) os inkeye FPLSE) ] Ra Wa Q TOHD s i In Rs TRE hak the the Valwe t, While FALSE Ih es vole 0. I}3: Se complex-’ A complex See WR is’ ete By the, pune : pe ae vole i- fa lea” | elass (2) | cee vee 4: Logical. : a a. lepleot oe ae ss offem vio Ses os betdicen vontabl el - + Slams ord legtad oberehion ae Kon). , a XEN, Y= 2a Ive -2 uh ; FALSE Meewan Class (2) [ustRve , v= FALSE ae | UBV YIV IV G FRLSE TRUE. reuse | cy . Statlng. valued 8 A xe ab. Poca. Bat Foo Chorocten ¥ solos, pol Bena : concate noted” usbag beste Suns chon. “clos : a P frame Seam" § lname * = " ee | , Patel trams, yImamme)) « | sprint (> ss 4, deloas) "Sonn" _ erected va < *k* Coma’) $s. oe S Sahin ; nee Ses "Palla Soha" | nS “Maing + Moxeovet, using shoint fuunctton WS com Som hab io dollars | i 58 % ae 2 substring: rea { existe ("Many ‘heb o Meee ehe Stok By My habeat MJ Se eye efind tomeplace a4 Sion i cation Stating » tumchion « [Sub (Ales big" a" Mang boda \Ble lava") omy bd a by low b! oe use Sub oe mussan 1e she oer obi eee) . Slobai2); VECTOR A Vector i$ a Sequemee of dota We used “c' fumekion,to crente amy vector. a Values on String Volueh. TO entre avec: we use", saa " ‘ cam tengih ee oor And ae erate fumehor oO © Roo ox More VectorS cam be 1 See eC lonmemtS of te Seme type.” PL eontoin$ rumenie String volue8 Snd combined USing the fusnehion c. Note- If we combine a aruda. srVUsM E2ue vestor Lith a. Shon. ; vector ther rdiumenie Volek ore con sidired GB Oo Storing ww the new Vector Tn onden Jgemaimdaim the Savne dole ‘uber © Patthmebtic oberotons of vectors one herforrmed smembenwiS® Ex- a=¢(1,3,5,7) arth a-b axl e) oe eat | Cae Nab S ec 4se) 3 3 8 '> Sea o/s 5 16 35 35 T a as OS * Broyeling. she - if tooo Vectow$ ane of umequel length he Shonda’ one ect be Teeyeed te match ane longer vector; Bx- WE atija0j38) ott pila oe Ve eC e249) uUrv 2 (0, 22,3342 3539) 5,365! roland in o vector by declaring am Index tnt Si " And if the index if B™ odie th coun ingide = Sot Oe eshose position hed Te Tame obsotute, Gelge 0% tha indox- H an Index 1S outof namge a missing, vio. the vere Na Volane is gaported Ex- $= e(o0" “Ey Teas, Nad Nee" apatites sta Ae fap Ault Sic) tee ae + Anecs vector com be sticed from a given eat | Mumenie Inder wechor, whieh Consists of memben poston of the omiainad wrector -fo be melnieved, © Index vector Whours dublieate volver. # Inder vector cam be out-of - onden. Tub, We cam obtain es mew vector wtih a differant orden. SNE ciccuarneer oe eet ee. © bro duce a vector Slice behwcem too Indexed, Wwe com USed the colon obenoton *:".: | Bx - Stelaa] SEirdbay3, >) Se(2i,3)), : : ! Abbe cok Anton, Gunde “bY Paaly “ealen! \ ae ot i i fC ne Mob! "ce" yaa : : | oA. oes arty Sliced” i a -Qiivem sie oy a logical. index veclon, ihich Anais be} oleh, same lenge OS Ane Soya vee: motor te CC FALSE TRUE SEAUSE TRUE, os Sty MELY Nagy OP, ST CLFALSE, TRVE. FALSE, TRVE FALSE) Poe ia, ects cam O88! pases’ to, veclor membenh USing Nowmed Sumetion. Rnd hen (& camaedaleve, ‘am Sraiben ‘aH We mame. We. Cam Who chamge tne onden (of tha Vee tow: chonacten String yrdex vector consisting she mek is 3 vecton na nad on den - VU cC'Laat’,” Finst")] a “Many EEO MATRIX A -moatvix 1S & Colleclion of dots. Ces as armrasnaed wm a to? dimemSional, Neelamaulor layouts. We cam cxecte amodatx inR ding “matat oe x fuel on- Ex - A= mataix(o¢ a 57) s79 ta data elements 72 Bi ae » freon ~ & oy | * An damemt ab Mre m qo. amd att corn of A Se be aceeb&d by dhe expression Am “i. | eRe emline wh now can be eximac Similonly, he emline 1n* co pa be ean © We cam akfe extnack-mone tham me mows of coluums ob ew time ubing OT, eC0,8)]. &x- AL ¢ (10) my BLS [cut] . Using dimname® fun hon ‘ . We Lain obSia ee to the nous wa Colorand ct tremmebrty, || hem e Camacets the elemanl S by names- ex - = divrnqaeb (A) = st (€ (r0.98, Caos aS SC Rea you, *ca3')} “B[%009" 5 "013" Vee ok o Men one ‘voniouk bes Uf we conSlauct ao rnadait 6} Colum ° wien Obbaim moorsioss of omy amolnix by tC ) Sunction = Te eslitinale bf tio waloiad ean the Same no. of Nong Ser BOeee i Norge, vnalanty Bing cbind ‘ebind ee oe cas oes hi mos" 60 stig rmatoiced it "3 : Vase de Ere ve. ot ‘Columns ith ih ehedO Pnetton. + becom deconsimue’ amy medaix ‘vSing ceo $ co function. * we cam Obhin invenSe of ovr smahont x using Solve() funelion. © VW find delenmninant tre the det), to find Sunk We ule, santstiebixy 4 brix().,40 Lind dimension. ¢ we uke diml) amd for Bron, (Wolo) eigen values oe ube eg. Jo oS AL™,). rc led a8 f sb) b constouck oO ynckaix WR Ai dal clemends,\¢ 1S Tited by. % ej woo wadatect Pama B of Whe Same one | A. a. i ; $ sof oF dole to ) Lin ey ond \ i ya Waites yn) \p) a. os'0n, | oAe rein HX d fe) Hen f CL Cam be done by Ane dnd the nee ano bot orden ma: Lary Wt ede, List’ iF we we hone wwlitble wwelong of di Benen ore \ we howe a Wetond ana ae Jone Short 5 Qe Cate | Cornbine. Whom Ahawgh N84 ey off ht x= we ¢ CR\38) Kod Se et%ay, Serrens tay fe) Jor, OP Re clton oT, © ey ‘ Xe WstOn, Ss bs ‘ ' + Ge cam sedsieve o Wisk Shea by [ Tie obenation «| phe thee Neg mn hg Why ate ' ; a @ vember i | , a am tndax vector, toe con edie e anulipl | 5 "ates a 2 Ho wer a US} -mumban © Mowe Wey, we Whe» corr ; i ’ Jaawe boca wh 1. @e Cam Pei Hye i wm. Sh contemt \n ho Lollorolay tong i) xt saa Kiehany A Poiurhinns oo} i wee “ye mgt wes — 8 | © ae cam xbSign: normed to Usk smmenmlvend amd gufer hum bY NW norheds instead of | mumente Uclede Sing those Nemes > tase, com, MeN ao Wok shen! Atooudn "EY av, ss mn “Meneoner 1S ing om inser veoh ton sisting Net ram atin," srommed ow Carn, TAME cneltiple wombers nom: ® nsh, Ex. Vise (bib ¢C% $3) odthne["a" Hed, NT Bob) NV beceyeln, bok”). ae stk's Lahr yHt Wes bh ay ‘s ao 7 © TD nafer a list member diswett by it’S “rey son"! een ida 4 W'S NOME ee tre a + % coll amy lish Mumber a Westie V[C"b ob Ve ES oA : y Ke 43 Citkouk ehentoning the Wsby ore have Q 3 53 to attach the Iist Using odlach function. We can detach the Ws In the Shmilan eocaye attach (Vv) bob 252 detach (Vv) Dotoframe ee | Ddaladzame. '$ used for storing Pie tie 11s ea é Aote forame Uhtn vectong of equal length. We Cam constnuch & Fe i o : : ra : ‘ Son: 2¢2,35) data. (name () fumenio Geel iar, "*) b= (tT ,7) AL = dedatrame (7, $4) 5 Rees mbecars- va doctePrameS! In odor Tene one. mony, butlt .t ‘ Aabla is cated to. beadwe . Re tof line’ Of a datgfnome containing the Column adterwendS demolS a of Hemor amd them 15 coUled a colh. — ° % suinievwe dota in cu colk Oe Ube Tow and Column condinoteS in i We cam olS0 wSe How and Column NameS| 7 instead of Te toordinote$- ex- Af [12]. | 0 get tha Mo. of Rows amd TP: of Columns fe 0 we use Nr wor” fumcHon sedhectively. @X- Yrow (af) sncol(dt). je Instead of bointing. out the online. data, tre com preview it Using heed Sametion Bx- head (df) amd ‘each hont zontal: line Jot)» Ohich begin$ 4h coth Pe Tame Nowed by the ac aL dota- Fach ram fa eda Lnos use. e Tesielen Bony Esluumn of aclada inane Wwe VERY a WS name Sass column no. citing 13) pn we am Sim ply oe use: +3. - obenaler.. Bee Nbbears Lt97]) eel an y ventean§ $ mn woteon §L., "amy, fg e Vo me fen ou column of a ditatoume W& use IF Comdinates of “nume ein [7]. we can sajrne we want ble. eolumnd Wing on idee veator within. LA Ex - ae wnke ok a dis watee cee ef J ie Bieta seca» Cee ony now v3ing TY eo Here we just! need * bute a ares ae ade Bx- mbeang [24,] , wn Feans (eC Bailnn 2 means [ 0(3,24)> a pert) 222",)] j ombeans [camano Bors ve oare com elle. ‘old eth leaicar fndex, veetyn « \n Ae Bitoni’ dented’ Li ythe rember: value’ 1S TRUE Je rtha HT ithbena lic, ram smission ama Ruse Ve obbeabey a4 eet sa 7 a ee ee aa 4 mokeong [Ls 1 4b - as R is Capable © noadiog cola from noel fonrnals Like 1 excek (Inesy,XLsx on Txt foment) $95, Sharla 5 $255.07 hens R abso hag two Tolive, dota SunrnalS — Rdadta amd RdS- Rana. 1S ubod to Save mollible R objects while Ras If Viel to Sane. O Single R pycject- * Self’ Solwd(t,..") 16 ubed 42 Sed dinectony to a sheeidtt location * gektod () tall print out, ‘he cme Aimectony Reading R data files - the cwremt tarking Raata files - Ex ~ ood ("Syrcay"edede”) Fumelion: lvad ), 00 \ood ("Sintveyerde') 04 Rds files ‘ Arlopos = TeeAaRbS (!Sumveq 085") Function: Read RDS() EE Reading Delimited Cota Files Sboce-belimited - Fumekion * jeed-table l dwjo Common bonarneter’ headen ond Sef. + Herne, we headen = TRUE y incidek varntable same We the flast Movs. ind Seb Indicates cohol 1 seherating the Anda. DeLaust igs aT ish Jodats Airy ne . TT oe eS tnepd: dhe l"Cilmydade) sunweg: dat’ eden *! T gepe v) ov snandlatle ( “sun ded vnadensTs seb" ") Cohen the coor King, dinis tony 18 Sot) Mab Delimited SSimilon af space —delimtte > Reo dod ata eriead. tatle ("Sinver met pends 13 Sih-'\t) Lonel eae ee RN 8 a yt eet ge om ‘Te Comma Delimited Pumehen Sead-¢svl) ‘ | ‘ Gxlo data ClommMa = Tead- csv (" Sunves dsv", nee | FPixed-aidth, Forenads Aume Kone mead. fw () 3 aa eves dey: © Tend tu C Sunvers, A an 1) bint edie Reacting sess, stata aud’ SAS Cora files - + 42 teste Wemeed fomelna R package Bo this. We need ik amd colt the Woarag ‘ ig ne | SPs | RBunelion: read. SP $5() | + Hene we howe too ¢ 27 IER shall tment the loaded 4 Defaut Is FALSE - ° labew = TRUE 1S R i” SSSR -leclond osth Hho is tow. Ex- nead- Spss ('c: Vm gdele (Survey. Sawe', to: dale. rome 27) ead. s hss (Lie. choose), whe Vole. labers = F > foramelers. to-date. fname osmon fon he “Tene. ; s eck 4 5 He Gpvanioneh OT cola leuclh-Me dvtawt | Auction Feo, Ree Me Bi hed Staribab dao | Re Lenk : «Convent. dateS: Convent STATE doles to Sate "ee cement dele Chess: Re defull is Tavs * conver dacteng: True to Convent Value lube into factors. Defaull \6 toue. Ex - dodestala = 7uad dba q" Savery de) ‘ sent amoriattcallin Covel mare daly : eased o ject MH Cobley carn Pot nne.: | Noles STATA Somelmes changes hur it Stones data tiles | Snomn one wansiow otha next amd the ‘breton backoge | oy tog, behind. YE %ead-dla command stedamn om exnom, | Ahem Sane. the dela fn ston Vina sWEoL® Command. SPOR BrP ellainay Ibalonl aus { | Ex~ dlasas= men + fr ANS, we reed to nStoll reads por! fC ~ e ell SAS ee eEeE ——— Rimelion : tead-xpont.U) de vbort ("C2 /mudate/S Reading Creel dala file LxLSx ov XLS) Aumchion.: read — excel ©) Porameten: + Sheet : Te rame of ht Shecbow US location no- — kage amd colt the Ubsrony Boe Tn Stoll - packages (1 7ead~L") Wherry (meadxe) dota Exeel = secd ~ excel (Survey: dota Exel = Jeeed - excel C "Sunvey .xls

You might also like