bao cao nhom 2

35
Khoa Phát Triển Nông Thôn * TRƯỜNG ĐẠI HỌC CẦN THƠ Học Phần: Anh Văn Chuyên Nghành NHÓM 2 Thành viên nhóm: Liêu Văn Nhựt B1210026 Nguyễn Thị Ngọc Hiên B1207780 Nguyễn Thị Trang B1210036 Nguyễn Thiên Lam B1210014 Phù Thị Kim Bảo B1209990 Lê Nguyễn Vân Anh B1209987 1

Upload: nhutlieu

Post on 14-Nov-2015

232 views

Category:

Documents


0 download

TRANSCRIPT

PowerPoint Presentation

Khoa Pht Trin Nng Thn

TRNG I HC CN THHc Phn: Anh Vn Chuyn Nghnh

NHM 2

Thnh vin nhm:Liu Vn NhtB1210026Nguyn Th Ngc HinB1207780Nguyn Th TrangB1210036Nguyn Thin LamB1210014Ph Th Kim BoB1209990L Nguyn Vn AnhB12099871Thread

LIST

2ContentSummary in EnglishSummarized by Vietnamese

New wordsGrammar

34

Summarized by EnglishIn chapter 4, we will be learnt about lists forming lists and doing with them.Although vectors, matrices and lists are all some similar points, lists have also some own major features. Technically, a list is a vector. So when creating a list, we can imagine that a list is as an employee database. Then, we can operate a list with some general tasks such as list indexing, editing list elements and stimulating the lists length. Besides that, we can also discuss about list components and values thanks to tags and we can apply functions to lists. Like using the apply () and apply () function. In this chapter, we can see Extended example that it help us to better understand about list and its components. Another feature of list is that list can be recursive; meaning that you can have lists within lists.5

Summarized by Vietnamese Trong chng 4, chng ta s hc v danh sch v cch hnh thnh v thao tc vi danh sch. Mc d c vector, ma trn v danh sch u c vi ci chung nhng danh sch vn c nhng nt ring. V mt k thut th danh sch nh l mt vector. Cho nn khi to lp mt danh sch, chng ta c th tng tng rng danh sch ging nh mt c s d liu v ti tuyn dng nhn s. Sau chng ta c th vn hnh danh sch theo mt vi thao tc chung nh list indexing, chnh sa cc thnh phn danh sch v c lng kch c danh sch. Hn na, chng ta cng c th tm hiu v gi tr v cc thnh phn ca danh sch nh vo tags .Cng nh chng ta c th ng dng nhng function cho danh sch.Trong chng ny, chng ta cng c th tham kho phn v d m rng hiu r hn v danh sch v cc yu t ca n. Mt c im khc ca danh sch l n c th quy, ngha l cc danh sch c th cht cha, chng cho ln nhau.Summary in English6 In contrast to a vector, in which all the elements must have the same mode, the list of R structure can combine different objects types. For those familiar with Python, a list R is similar to a Python dictionary or, for that matter, a Perl hash. C programmers may find it similar to a C structure. This list plays a central role in R, forming the basis for the data frame, object-oriented programming and such. In this chapter, we will introduce how to create a list and how to work with them. As with vectors and matrices, a popular activity with the list is indexed. List index is similar to the index vector and matrix but with some major differences. And like the matrix, there is a similar list for the application () function. We will discuss this topic and other lists, including lists ways to take apart, often useful.

Summarized by Vietnamese 7 Ngc li vi mt vector, trong tt c cc yu t phi c cng mt ch , danh sch ca R cu trc c th kt hp cc i tng khc nhau cc loi. i vi nhng ngi quen thuc vi Python, mt danh sch R l tng t nh mt t in Python hoc, cho rng vn , mt Perl bm. Lp trnh C c th tm thy n tng t nh mt C cu trc. Danh sch ny ng mt vai tr trung tm trong R, hnh thnh c s cho cc khung d liu, lp trnh hng i tng v nh vy.

Trong chng ny, chng ti s gii thiu cch to danh sch v lm th no lm vic vi h. Nh vi vect v ma trn, mt hot ng ph bin vi cc danh sch llp ch mc. Danh sch ch mc l tng t nh vector v ma trn ch mc nhng vimt s khc bit ln. V cng ging nh ma trn, danh sch c mt tng t cho cc p dng () chc nng. Chng ti s tho lun v ch ny v danh sch khc, bao gm c cch tn dng danh sch ngoi, thng c ch.

Summary in English8 Technically, a list is a vector. Ordinary vectors-the kind we have used so far in this book-called atomic vectors, because they components can not be divided into smaller parts. In contrast, the list is called recursively vector. For the first look at our list, we consider a database of employees. For each employee, we want to store the name, salary, and a Boolean union members only. Since we have three different modes in this letter, number, and logic, it is a perfect place to use list. The entire database of us have then is a list, or some other type of list as a data frame, although we will not pursue it here. We can create a list to represent our employees, Joe, in this way: We can print out j, either wholly or by components: In fact, the ingredient called card-R in the literature aswage is optional. We can do this.However, it is generally considered to be clearer and less error-prone use names instead of numbers.The name of the element in the list can be abbreviated to any extent as good without causing ambiguity

Creating ListsSummarized by Vietnamese 9To List V mt k thut, mt danh sch l mt vector. Ordinary vect-nhng loi chng ti c s dng cho n nay trong cun sch ny-c gi l vect nguyn t, v h thnh phn khng th c chia thnh cc phn nh hn. Ngc li, danh sch c gi l vect quy i vi ci nhn u tin ca chng ti danh sch, chng ta hy xem xt mt c s d liu ca nhn vin. i vi mi nhn vin, chng ti mun lu tr tn, tin lng, v mt cng on ch Boolean thnh vin. K t khi chng ti c ba ch khc nhau y k t, s, v logic, n l mt ni hon ho s dng danh sch. Ton b c s d liu ca chng ti c sau l mt danh sch lit k, hoc mt s loi khc ca danh sch nh mt khung d liu, mc d chng ti s khng theo ui iu y. Chng ta c th to ra mt danh sch i din cho nhn vin ca chng ti, Joe, theo cch ny: Chng ti c th in ra j, hoc l ton b hay bi cc thnh phn: Trn thc t, cc thnh phn tn gi l th trong vn hc-R nh lng l ty chn. Chng ta cng c th lm iu ny Tuy nhin, n thng c xem l r rng hn v t li d s dng tn thay v ch s s.Tn ca cc thnh phn trong danh sch c th c vit tt bt c mc no l tt m khng gy ra s m h

Summary in English10 List of General Operations

Now that you've seen a simple example of creating a list, let us see how to access and work with the list.1.List of Indexing You can access a list of parts in different ways: We can refer to the list of ingredients of their index numbers, treatmentlist as a vector. However, note that in this case, we use double quotes instead of single ones.So, there are three ways to access an individual component c of a list lstand return it in the data type of c

Summarized by Vietnamese 11Danh sch chung Operations

By gi th bn thy mt v d n gin ca vic to ra mt danh sch, chng ta hy xem lm th no truy cp v lm vic vi cc danh sch.1. Danh sch Indexing Bn c th truy cp vo mt phn danh sch trong nhiu cch khc nhau:Chng ti c th tham kho danh sch cc thnh phn ca ch s s ca h, iu tr danh sch nh mt vector. Tuy nhin, lu rng trong trng hp ny, chng ta s dng du ngoc kp thay v nhng ngi duy nht.V vy, c ba cch truy cp vo mt thnh phn c c nhn ca mt danh sch lst v tr li n trong cc kiu d liu ca c

Summary in English12

Each of these are useful in different contexts, as you will see in the next for example. But note that the qualifying phrase, "return it in the data type c. "An alternative technique for Monday and Tuesday are listed as use parentheses above quotation: Both single and double-rack-rack access list elements in vector-index index fashion. But there is an important difference from normal (atomic) vectors indexed. If the brackets [] are used, the result is a list-a sublist of the originalActivities Subsetting back list included two first the components of the original list j. Note that from the back makes sense here, since only the functions of the frame. This is similar to the other cases you have seen operators that do not initially appear to be functional, such as +.Conversely, you can use quotation marks [[]] for reference only single component, with the result that the type of component.Summarized by Vietnamese 13Mi trong s ny l hu ch trong bi cnh khc nhau, nh bn s thy trong tip theo v d. Nhng lu cc cm t vng loi, "tr li n trong d liu loi c. "Mt thay th cho cc k thut th hai v th ba c lit k l s dng du ngoc n hn ngoc kp:C hai n-gi v double-gi yu t danh sch truy cp ch mc trong vector-index thi trang. Nhng c mt s khc bit quan trng t thng thng (nguyn t) vector lp ch mc. Nu du ngoc n [] c s dng, kt qu l mt danh sch-mt sublist ca bn gcCc hot ng Subsetting tr li danh sch khc bao gm hai u cc thnh phn ca danh sch j gc. Lu rng t tr li lm cho tinh thn y, k t khi ch s khung l cc chc nng. iu ny cng tng t nh cc trng hp khc bn thy cc nh khai thc m khng lc u xut hin c chc nng, chng hn nh +.Ngc li, bn c th s dng du ngoc kp [[]] cho ch c mt tham chiuthnh phn duy nht, vi kt qu c kiu ca thnh phn .

Run a time Implement a doSomeLongWork() method on LunchList. Create a private Runnable in LunchList. + Step3: Fork the Thread from the Menu Arrange to do this long work at some point, add another menu choice, Update the LunchList/res/menu/option. xml file to look like the following. Find things (graphic image) around 32px high. Update onOptionsItemSelected() in LunchList. Recompile, reinstall, and run the application. Appear the new menu item.

Summary in English14 2. Add and Remove List Elements The operations of adding and deleting the list of factors arising in a surprising number of contexts. This is especially true for the data structure which lists the platforms, such as data frames and layers R. New components can be added after the list is created. You can delete a part list by placing it into the NULL3. Getting size of a ListSince the list is a vector, you can get the number of elements in a list by length ().

Summarized by Vietnamese 15

2 .Thm v Xa Danh sch Elements Cc hot ng ca vic thm v xa danh sch cc yu t pht sinh trong mt s ng ngc nhin ca bi cnh. iu ny c bit ng i vi cc cu trc d liu trong lit k thnh nn tng, nh khung d liu v cc lp R. Linh kin mi c th c thm vo sau mt danh sch c to ra. Bn c th xa mt phn danh sch bng cch t n vo NULL3. Bt Kch thc ca mt ListK t khi mt danh sch l mt vector, bn c th c c s lng cc thnh phn trong mt danh sch thng qua chiu di ().

Summarized by English 16

4. Extended Example: Text Concordance Web search and other types of text data mining are interested today. Please use this area for an example of a list of codes R. We will write a function called findwords () will define these words in a text file and compile a list of the locations of occurrences of each word in the text. This will be very useful for analyzing contextual. To define words, we replace all characters with spaces nonletter and exit of capital. We can use the string functions presented in Chapter 11 in order to do this, but to keep matters simple, this code is not displayed here. This list includes a component for each word in the file, with one of the component displays the location of the file from which occur.Sure, the entries are displayed as occurring at positions 7, 14, and 27.Before looking at the code, let's talk a little about our choice of a structured list here. Another way is to use a matrix, with one row for each word in the text. We can use rownames () to name the restaurant, with the entries in a row showing the position of the word. For example, items will include 7, 14, 27, and then 0s in the rest of the row. But matrix method has some major drawbacks:

Summarized by Vietnamese 17

4 .Extended V d: Vn bn Concordance Web tm kim v cc loi khc ca khai thc d liu vn bn l nhng quan tmngy hm nay. Hy s dng khu vc ny cho mt v d v danh sch m R. Chng ti s vit mt chc nng gi l findwords () s xc nh nhng li ny trong mt tp tin vn bn v bin son mt danh sch cc a im ca cc ln xut hin ca mi t trong vn bn. iu ny s rt hu ch cho vic phn tch theo ng cnh. xc nh t, chng ta thay th tt c cc nhn vt nonletter vi khong trng v thot khi vn. Chng ta c th s dng cc chc nng chui trnh by trong Chng 11 lm iu ny, nhng gi cho nhng vn n gin, m nh vy l khng c hin th y. Danh sch ny bao gm mt thnh phn cho mi t trong cc tp tin, vi mt t lthnh phn hin th cc v tr trong tp tin m t xy ra.Chc chn, cc mc t c hin th nh l xy ra ti v tr 7, 14, v 27.Trc khi nhn vo m, chng ta hy ni mt cht v s la chn ca chng ta v mt cu trc danh sch y. Mt cch khc l s dng mt ma trn, vi mt hng cho mi t trong vn bn. Chng ta c th s dng rownames () t tn cho cc hng, vi cc mc trong mt hng hin th cc v tr ca t . V d, mc hng s bao gm 7, 14, 27, v sau 0s trong phn cn li ca hng. Nhng phng php ma trn c mt vi nhc im ln:Summarized by English 18

There is a problem of columns allocated to our matrix.If the maximum frequency that the word appears in the text we are, say, 10, then we will need 10 columns. But we will not know ahead of time. We can add a new column each time we encounter a new word, use cbind () (in addition to using rbind () to add a row to the word itself). Or we could write code to do a preliminary run through the input file to determine the maximum frequency. Either of these will go to the expense of increased complexity and code may increase the runtime. A program such storage will be quite wasteful of memory, because mostcustomers will probably include a lot of zeros. In other words, the matrix will be sparse-a situation that often occurs in the analysis ofcontext.

Summarized by Vietnamese 19

C mt vn v ct phn b cho ma trn ca chng ti. Nu tn s ti a m mt t xut hin trong vn bn ca chng ti l, ni, 10, sau chng ti s cn 10 ct. Nhng chng ta s khng bit rng trc thi hn. Chng ta c th thm mt ct mi mi ln chng ti gp mt t mi, s dng cbind () (ngoi vic s dng rbind () thm mt hng cho t bn thn). Hoc chng ta c th vit code lm mt chy s b thng qua cc tp tin u vo xc nh tn s t ti a. Hoc l trong s ny s i vo chi ph phc tp tng ln m v c th tng thi gian chy. Mt chng trnh lu tr nh vy s kh lng ph b nh, v hu ht hng c l s bao gm rt nhiu s khng. Ni cch khc, cc ma trn s l tha tht-mt tnh hung m cng thng xy ra trong phn tch s ng cnh.Summarized by English 20

Thus, the structure of the list really mean. Let's see how to code it. We read in the words of the file (from simply means that any group of words separated by spaces) by calling scan (). The details of the reading and writing of files covered in Chapter 10, but the important point here is now txt is a vector of strings: a string for each instance of a word in the file. Here is what looks like after reading txt Activities in the list of lines 4 to 8 build our own turn, a wl name (for nouns). We iterate over all the words from our long road, with WRD is the current one.Let's see what happens with the code in line 7 when i = 4, so WRD = "that" testconcorda.txt files in our example. At this point, wl [["that"]] would not exist. As mentioned, R is set to one such case, wl [["that"]] = NULL, which means that in line 7, we can join it! Thus wl [["that"]] becomes an element vector (4). Then, when i = 40, wl [["that"]] becomes (4.40), representing the fact that the words in file 4 and 40 are both "that".Note how convenient it is a list of items that can only be done through citations wire, such as in wl [["that"]]. An advanced, more elegant version of the code using separation R () function, as you will see in section 6.2.2.

Summarized by Vietnamese 21

Nh vy, cu trc danh sch thc s c ngha. Chng ta hy xem lm th no m n.Chng ta c thy trong nhng li ca cc tp tin (t ch n gin c ngha l bt k nhm ch cch nhau bi du cch) bng cch gi scan (). Cc chi tit ca vic c v vit cc tp tin c bo him trong Chng 10, nhng im quan trng y l by gi txt s l mt vector ca chui: mt chui cho mi th hin ca mt t trong cc tp tin. Di y l nhng g trng ging nh txt sau khi cCc hot ng trong danh sch cc dng 4 n 8 xy dng bin chnh ca chng ti, mt wl danh (i vi danh t). Chng ti lp qua tt c nhng li t ng di ca chng ti, vi Cc Thy li l mt trong hin ti.Hy xem nhng g s xy ra vi cc m trong dng 7 khi i = 4, do Cc Thy li = "rng" trong testconcorda.txt tp tin v d ca chng ti. Ti thi im ny, wl [["rng"]] s khng tn ti. Nh cp, R c thit lp trong mt trng hp nh vy, wl [["rng"]] = NULL, c ngha l trong dng 7, chng ta c th ni n! Nh vy wl [["rng"]] s tr thnh mt phn t vector (4). Sau , khi i = 40, wl [["rng"]] s tr thnh (4,40), i din cho mt thc t rng nhng li 4 v 40 trong tp tin l c hai "m".Lu cch tin li n l danh sch ch mc c th c thc hin thng qua trch dn dy, chng hn nh trong wl [["rng"]].Mt nng cao, thanh lch hn phin bn ca m ny s dng tch R () chc nng,nh bn s thy trong phn 6.2.2.

Summarized by English22

Access List the components and values If the elements in a list without the card, as is the case with the name, salary, and the union for j in Section 4.1, you can get them through the name ().The return value of unlist () is a vector in this case, a vector of strings. Note that the name of this element from the vector components in the original list. Here, R chose the lowest common denominator: the string. This sounds like some kind of priority structure, and it is. When the help of R for unlist () says: If possible ingredients list coerced a common mode of unlisting, and so the results are often ends up as a character vector. Vectors will be forced to remove most of the components in the hierarchy NULL