[go: up one dir, main page]

0% found this document useful (0 votes)
16 views18 pages

Dar

It is a concept of R programming and it is a simplified notes for beginners

Uploaded by

abhirat8901
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)
16 views18 pages

Dar

It is a concept of R programming and it is a simplified notes for beginners

Uploaded by

abhirat8901
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/ 18
dayDi seuss fon lr the basic leet cuty PE in R corth cw suitable, example, ; > [Dodebype Snample | vemigy Logicak TRUE ; Fol LSE Vd- TRUE Paink Celos£¥I) 4b paw decks the followin. Joresceth: b d i 1CQ " logiceet" INemenic |123451999 INa-2be | Prine CclassCv)) ir produces the eee nese? [COs Mumemnic” 2-2b Paint Classe) TE produces the dollesing | nesust: _| cas Drdeqen \V4- 2424 | PrwtCclosscvy) ‘ib produces the pelloving | | mresuet: UU “comple” Trtegen 2,34L,oL een ‘chosoctea tat, “qood*, TRUE a Vg~ TRUE” Pov vbCclasscv 9) Th poroduces the filesng wrest 10 ® chanced) Race [upetto" ys stoned. asus | vz- chor RecaC*Hello'D 5 66 Ge & our Colersscu)) es 66 be Of arasdeecte folowing nes . PB) Waite ah program to get the giast 10 Fibuacc ben, ' ae. os get -fi bonacc} > Sanction Cnj& > gi bonocd —numbens pind _mox-min 2- function Gin pect -vecton JX igc length Cinput -veclon)=>0)e cat C"“Enput vector i¢ emply. Plase paride anon- empty yeclon.\n") Netunn CNULL) y Max-value 2~ max Gin pet —veeton) min-value < -min Cinput —vecton) Cak C'Maximum value D"\ martvalue “\n"') cob ¢ “Minimum value: ", Min_value , As; Netunn (list Cmoximum: mar ~vaht ing = min-vatue )) UE yMINi mums Your-veclon 2- ¢Cs,3, QW Nesut& <- pind —max- mint Martvalue L- nesuth £$ ma YOUD -Vecton ) timum Explanation of the syntos: CYgind max-min? 1s User -degined fanchon thab takes avectn as in pur. + aingide the funckon, it cheeks if the inpu® vecton ts emp and anefuan a mesege git * the ‘marcy’ and ‘mine 7? Junctions ane used to caleutate the maximum ond minimum valies of the veeton , neg pectively. * the ‘cab ‘function reused to pant , the console. the function aneduans o! the nesuh + ist containing both the maximum and minimum Vuues - dn esample usage of the furesion 1s proviced wi the vecton tyour vy eclos’, © The individual Mar mum and minimum values can b ace essed from the neswt using SF mati ynum! ard Frvini mum sores pee hive iy Yod Leis coeate the gollocsing velo ae-y veg wet €) emer tO esithomth metic opearection ,~ 7 f,and* to Syadd wand vy > substrack Vi frem UW >9 multiply U b y divide WbYV Y nise wle Whe pooea of a => addition t- urv sup taaction <~ u-v mutti plication <— or division 2- UNV ex ponentiakion £- Ut cakeus 7", addition, "\n") cae Ct v2", subkaaction, yn) cak CN UFY 2 terse ; cok (niivis# as whit cadion svn Be _ division . Wn") cob C§OUAV= “exponentiation s\n"). 4 Lbs waite a R progaam to get aU prime numben upto & diver numben. (D> Sitveog enakosthenes Z- punctioncnrt | PONE L- re PLTRVE, n+) PL-2 while Ce*prenye if (poime Ep] 2 oD Gin Seq Gy 02 ne PI) Prime Ci) 2- FALSE ES) Pl-pry BY gon CPIA seg er, n+ L iter ime€p pe Pi RECP) J yy n l-50 Cok (Following ane the prime Numbeas smeelhen \n") cat C“ Than od equal to". n\n") Sieve yf enadosth enescn). Fe) B emonst of a uN copy pac fonial -necuasive © function cnr Wy Cnd= ADR netunn C1) else ee Gs foctoniat _ntcunsive (0-1) ) an R cece 4a find the ac ioral Crts@ A @cumssion 3. ¢ ‘Enter a NL- as. in tegen cacad line CPAmMpe = Numben +") Nesuk 2- Yactonial —mnecuasi veen ) Cae C'The sortoaial % ES", nesutt) 5b show nowto cede 2 pacgaem to cache a Dato poanes whith Cantain details 9S employ es ond disply the details. > em Ployee— doco De data. gname EmpwyeelD = €C1,2,3, 415), Name > OC"John", "Jane", Bob" Mice", “chaslies) tg @ +6030, 29 35,25,40), 2 Selasy = C $0000, 60000, 19 000, 55000, $0000) Depasment = C C1HR", IT", "Pinance”, “Moa khing'; ) “0 pencdions") cak (“Employee Detalls.vn") Prine Cemployec —dacta) ofp. EmployeLD = Name dg e | De pamriment 1 Tohn do 0000 HR 2 Tone 28 60000 &T : 3 Bob 35 10000 Finance, uy wilice 2 sso0o Man keting Ss chanlie 4o 80000 openaions beni Nis Gay Bluside RB Parag nam 4o caecedle the syslerns Foka. of bees cunnnt dele with and vwilhowt time explain with o Syslet, : -S cunoed— dabe <- sys. Dake) Cab C* current date without dimes", Cusnent- cake, ‘Any cunnent — datetimer- sys+ time ) cok C’Cunnenk date wihtime:”, Cuanenk _daketive Deyn") = 8s. Datel’ netumns the cannert date in the form of yyy y-mm-DD" a ‘sys. timecy’ netuans th yime inthe pony “yy yy -mn “DD HHMM: 55". e cunnent dota and 5S unite PB prgynam te check agivn number is Even OnOdd, > Check even-odd 2- function Caum bearded Tf Cnumben dl 22020) & Cat Cnumben,"15 even. ne) Yelse L Co& Crum bea. odd \n") 4 a yn pwe -numben 6-7 check—even ~odd Cinput-number) Tes gaplain opercction on Vectans D> Feneating Vectons * numenic—vec ton 2-o€1,2,3h05) * Chanacten —vector <- © Crappie", “onange ", “banana” ) * logs cab -veeton de CTRUE 1 Pulls? , FR0E ) 2, Accessing Elements : dinst eelement £- mumeaic ~vecton Cy B+ Vecton if nithmetic + MesUll- VeEcton L- Numeric —veCcton+7Z. Nesult~ vecton 2-numenc—vecton* 2, 4 Logical openations: ° logy cab ~nesulsé L-numeNiC_vec for >2, 5. Vecton Concatenceborn ‘ combined “Nec to L- olnumenc veto, 6,1) ' Nectod Len 6 “Vectoo ~length £- length ¢ numenie —vecton) Ve VectoD Functions " Sum ~ neswlt L-sum Cnum tae —vectan ) ‘by waite the 2B code gor the following *) Calling o gone ton witt ) coutding a pon! on iiny couesing oo fore tion wt? you wank => Hb Function with defaule wngument de fautt -angumend “fun ction 2- fort Hon Cname: “Toha'ye cak C"Hello” name , “| This is a functon with oO default angumenk \n" ) y Function with angument angument ~ gunction £- Junction cgay ceting I< cak Cgneding: this is a Junction with an ¥ ON gum ert. \n") a *Tno- angumert - function 4- function c IL cat Chis is a function coithouk ongumerd, | An) | ; | Von ‘ | | de Joult - ongum ert —punctionc) | default ~oagumenk —functontAlice*) | CabC™\N cabling a gunction with axgumerk. Wi") OD gumenk - action (" Hi thene!”) | Cat C™IN Coll; o function withonk angurnert ny ho argument finch one ) cuss briefly pled€ 2 go» De Ji ’ Junction with on z fle. >The team plor genction Sa Defers te unctions thet ane used to Covake visual ae panesertations dasa. En LS CC 12,3, Us) y 4-662, 4,1, 14) Plor C4Xiy main =“scatden plot "4 labs » mans", Ylab= oer Pech 1G, Col>"bheey ouk pub: data Por nbs, © LLY ane numa vectoa NE pane serhin g the | | be & Main Bpetigics the title of the te : on EONS L Ya Le Leto £ 'Ylab! set the labels 7 *"Pch’ determines the plotting symbol ® ‘oot sets the clon of the plotting sym bo ly Eby Summari2e Hhe vaaius R-loops aith an example, > R-Repeat loo The mepeak loop executes the same code Again s again until o stop condition is met. Synkat « | nepeak % commands ifCcon ditiond< Daeak J | Bf condition] £08 = | | eee he | __e€ondi or Gane “sf con di Honis Y [ Jolse. | be = = a ae &92 VZ~(C"Hello") olp. "“Hetlo” Cnt <~2 “Hello” repeat < " Hello” Paint Cv) ent €- cnt +) Cert 5449 18 bee Pk Q- while loop eye The while loop execubes the same co de Coa and again until stop condition is mee. synbax while Ctest_con di tion 2X Pr iekatod fla Chas; Con dition is true code blek| B £cond) tin ____ sbengisen Oo egy ve-cC' Hello’) ofp: one <2 “Hello” while Corb 459% Hello” Paine Cv) “ Hello” ent =cné+] ae s) R-fon loo fon loop is a nepedition contnol sJnuchunre that allows youto egfpicierdly waite a loop that needs to exccube a specific Num be) Y times: - Syntax; on ( value ip vectonJd y Statment flow chat ex: : outpub? vol" VZ- LETT ERSE 4) +g" porciin vr ue? paint GD “Dp ¥ go List the vanius fcakog xR isa well- devetoped ,simple and. offecti oe Pnogn ammin Vangu e which includes condi tones, }oop ; use? degined necunsive functions and inpub £ owkput focilities. ® Qhas an effective dato han dling and stonvge gos ly. % Q ponovides asuite of cpencdtons gon Calcutadions on omaay ; lists veeton as matanices x RK provides alange , cohemené and inte gaude- —d collection of tools pon debe analysis. eR pnovides gnaPphicat focilitiens Jor dato analysis and. display eithen di nectiy atthecanpdeal — —————————— ee he i jb I usvtade the usage Yip s if elie ap abernerk age 4 in RK, b 3 2 By, Siakment: The ‘if’ statment is used when You wank to eretube a block of Code only Bo oO specified condition 15 taue. Synban; igc boolean -expaession)® 4 Stakmenk ¢s) Floco diegnam 9 : condition 58 ehe” if ‘ en ae oCtwhak "is", «4 auth’) Tf C8 Touhy bia WIL Point “Truth is found") Ised ye eae! C&T auth is net found’) Y olp: “Towth is not pound” loa) Define foston- How to Cocake cr factor cind how Te cece comportnts of & gucton. >A facton 18 % cabegonial voaiabte thot nepaeserds o fined set of distinct ves c neaking facton: cab egqon _vecton 47¢ C’ Red", "Bre x © Red ood. sont “e Becton tentere, 1 Mgneen * "Red ait ‘ YY -Veotan) fm pout om -Vamiable). I ee Hlob) waite o Short node on : i) Explonedomy Dako. Analys: sCEDdd). | >DA is a chrucial step in the dato scince pancess) that helps 0 undenstand the underlying | stnuctune of dataset. * One of the most efficient ways +0 perfoame j EDA is the thnough the use of graph cab | nepnesentakioa of the deta. | *Gmophs con aevial patterns, outliers - and gelationships with the datathatmaynot | be immediately ap panent poor the ace | * Ris populoa programming languoge Zon dota oneigsis and yisuati 2ab%n, ond one of the most widely used |i bancoy gon cneadirg high quabiy| Publication mead. goaphics in ggplet2. iy Main Gnaphi cal Package » 9g lok &: | out idea. behind gg plot bk basnany is thet} one can build every graph goon the~same components such os dabo seis, Co-on dinate system and ynone, D Latkice: & Igthice is ao powerful high Jevel dato viswalizecia; J} systern Bon R that is designed with an empharis | on. multivariate data atlowes to cnecte mutt ple smaw. plots easily. Dd Plotly Ploaly 15 aN open Source Q Packoge Zon Ps oi aie cnreaking ntenactive web based gnaphs vio cae 4 open sounce javasnipt grarhing biboasy Plo! “95. KY. coloun Picken * coloun Picken 75 & tool gon oy framework ond Jon selecting colours inthe plots. ® This tool supports Nanos options, such os ab pate Hens,and mone, Opacity custom coloun S Pakch voonk % patch cook is ov packag pL to blows Jom the oabi to com position plots by poovieins openatons fon combinging multiple Plots. e that exponds the 1Y complex macthemecsiceel

You might also like