same data: Data Frame A Data Frame B Country Algeria Brazil Columbia Country Algeria Algeria Brazil...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
same data: Data Frame A Data Frame B Country Algeria Brazil Columbia Country Algeria Algeria Brazil Data Frame C Columbia Columbia Brazil Here are three data frames, A, B, and C, with different organizations of the Year 2000 2001 Algeria Brazil 12 14 Y2000 7 12 16 Year 2000 2001 2000 2001 2000 2001 1. Comparing each of the following pairs of tables, is one considered "wider" as described in the chapter? If so, say which is wider; if not, explain. o A versus C o B versus C o A versus B 2. Which table format do you think would make it easiest to find the change from 2000 to 2001 for each country. How would you do it? 3. Suppose you have another table, ContinentData, which gives the continent that each country is in. Which table format do you think would make it easiest to find the sum of the values for each continent for each of the years? How would you do it? Columbia 16 Y2001 H Value Finally, the analyst needs to specify which are the variables to be gathered. For instance, it hardly makes sense to gather subject with the other variables; it will remain as a separate variable in the narrow result. Values in subject will be repeated as necessary to give each case in the narrow format its own correct value of subject. Here's how to gather variables from BP_wide and convert the result into BP_narrow. BP wide XX gather (key E when, value= sbp, before, after ) #alternative syntax; note the required quotes when specifying new column names BP wide %>% pivot_longer(cols= c(before, after), names_to= "when", values_to= "sbp") Again, the names of the key and value arguments are given as arguments. These are the names invented by the data analyst; those names are not part of the wide input to gather (). Arguments after the key and value are the names of the variables to be gathered. Example: Gender-neutral names In "A Boy Named Sue", country singer Johnny Cash famously told the story of a boy toughened in life by being given a girl's name. Indeed, Sue is given to about 300 times as many girls as boys according to Table 12.4. BabyNames %>% filter (name an "Sue") %>% group_by (name, sex) %>% Summarise (total = sum(count)) name sex total Sue F 144410 Sue M 519 Ta same data: Data Frame A Data Frame B Country Algeria Brazil Columbia Country Algeria Algeria Brazil Data Frame C Columbia Columbia Brazil Here are three data frames, A, B, and C, with different organizations of the Year 2000 2001 Algeria Brazil 12 14 Y2000 7 12 16 Year 2000 2001 2000 2001 2000 2001 1. Comparing each of the following pairs of tables, is one considered "wider" as described in the chapter? If so, say which is wider; if not, explain. o A versus C o B versus C o A versus B 2. Which table format do you think would make it easiest to find the change from 2000 to 2001 for each country. How would you do it? 3. Suppose you have another table, ContinentData, which gives the continent that each country is in. Which table format do you think would make it easiest to find the sum of the values for each continent for each of the years? How would you do it? Columbia 16 Y2001 H Value Finally, the analyst needs to specify which are the variables to be gathered. For instance, it hardly makes sense to gather subject with the other variables; it will remain as a separate variable in the narrow result. Values in subject will be repeated as necessary to give each case in the narrow format its own correct value of subject. Here's how to gather variables from BP_wide and convert the result into BP_narrow. BP wide XX gather (key E when, value= sbp, before, after ) #alternative syntax; note the required quotes when specifying new column names BP wide %>% pivot_longer(cols= c(before, after), names_to= "when", values_to= "sbp") Again, the names of the key and value arguments are given as arguments. These are the names invented by the data analyst; those names are not part of the wide input to gather (). Arguments after the key and value are the names of the variables to be gathered. Example: Gender-neutral names In "A Boy Named Sue", country singer Johnny Cash famously told the story of a boy toughened in life by being given a girl's name. Indeed, Sue is given to about 300 times as many girls as boys according to Table 12.4. BabyNames %>% filter (name an "Sue") %>% group_by (name, sex) %>% Summarise (total = sum(count)) name sex total Sue F 144410 Sue M 519 Ta
Expert Answer:
Answer rating: 100% (QA)
Comparing table formats 1 Comparing width A vs C A is wider Each year has its own column in A while ... View the full answer
Related Book For
Fundamentals of Ethics for Scientists and Engineers
ISBN: 978-0195134889
1st Edition
Authors: Edmund G. Seebauer, Robert L. Barry
Posted Date:
Students also viewed these accounting questions
-
Which of the four path-goal styles do you think would be the best for managing a group of software engineers? Justify your answer.
-
Three disks A, B and C with same radius 5.0 cm are placed at coordinate (0,50 cm), (-15 cm, 0), and (15 cm, 0), respectively as shown as Figure 1. The masses of the three disks are ma = 0.2 kg, mg =...
-
The figure shows points A, B and C with position vectors a, b and c respectively, relative to an origin O. The point P lies on AB such that AP: AB = 3: 4. The point Q lies on OC such that OQ:QC = 2:...
-
Write a paper on the brothers karamazov, fyodor dostoyevsky creates a conversation between two brothers: the cynical ivan, and the devoutly religious and earnest alyosha. In their dialogues...
-
Getting a degree from a college or university can be a long and difficult task. Certain courses must be completed before other courses may be taken. Develop a network diagram, in which every activity...
-
Repeat Prob. 1336 for a flow rate of 30 m 3 /s. Data from Problem 13-36 Water flows half-full through a hexagonal channel of bottom width 2 m at a rate of 60 m 3 /s. Determine a. The average velocity...
-
Water flows at a rate of 10 gallons per minute in a new horizontal 0.75-in.-diameter galvanized iron pipe. Determine the pressure gradient, \(\Delta p / \ell\), along the pipe.
-
Alliance Air is a service in which customers pay a flat-rate to Alliance Air and are guaranteed a seat on an airplane between any two locations. To offer this service, Alliance Air prepurchases daily...
-
Calculate and interpret the present value of growth opportunities (PVGO): Here is a company's information: Share price $80 Expected earnings $5 Required return on shares 10%. Choose the best answer:...
-
WestGas Conveyance, Inc. WestGas Conveyance, Inc., is a large U.S. natural gas pipeline company that wants to raise $120 million to finance expansion. WestGas wants a capital structure that is 50%...
-
A store is selling this products on bundle. The term of payment is 15,000 on the date of purchase and the remaining balance will be paid equally for 12 months. A contract from home credit was signed...
-
A \(1000-\mathrm{kg}\) car traveling at \(5.0 \mathrm{~m} / \mathrm{s}\) runs into the side of an underpass. The concrete wall is not affected, but the car crumples such that in the time interval...
-
Citizens Medical Centre, a hospital in Victoria, Texas, recently instituted a new hiring policy that bans job applicants from employment for being overweight. The new policy states that the hospital...
-
CN Rail is the largest freight railway in Canada, with 22 696 employees. It operates the largest rail network in Canada and the only transcontinental network in North Americain eight provinces in...
-
Carol Bartz, Yahoos hard-driving CEO, was fired over the telephone in a conversation with Chairman of the Board Roy Bostock. The firing came with more than a year left on her contract, as Yahoo...
-
A system consists of two interacting particles 1 and 2 , with particle 1 confined to an \(x\) axis and the system in equilibrium when particle 1 is at a given position on that axis. If displacing...
-
3. Given the recurrence relation: Calculate T(n) for n= 1.2.3.4.5. 12 T(n) T(n)= 3T ([n/2])+ 2m +1 T(0) 0 1 2 3 4 5 [10 pts
-
Explain the buyers position in a typical negotiation for a business. Explain the sellers position. What tips would you offer a buyer about to begin negotiating the purchase of a business?
-
A wheel has a thin 3.0-kg rim and four spokes each of mass 1.2 kg. Find the kinetic energy of the wheel when it rolls at 6 m/s on a horizontal surface.
-
(a) What is the maximum speed of the particle in Problem 6? (b) What is its maximum acceleration?
-
What is the reactance of a 1.0-nF capacitor at (a) 60 Hz, (b) 6 kHz, and (c) 6 MHz?
-
If a product is produced in high volume by a few large organizations, what phase of the product life cycle is it most likely in?
-
Is a highly standardized product usually produced through a make-to-order or a make-to-stock processing strategy?
-
Does providing customized products generally involve less capital investment or less skilled labor, when compared to more standardized products?
Study smarter with the SolutionInn App