Question

In: Computer Science

Which of the following is TRUE about horizontal data merges using R? (Multiple answers can be...

Which of the following is TRUE about horizontal data merges using R? (Multiple answers can be selected)

a) Both data frames must have the same number of columns

b) Both data frames must have the same number of rows

c) The data frames must have at least one column with values in common

d) The data frames must have at least one column with the same name

e) Both data frames must have the same order of columns from left to right

Solutions

Expert Solution

A horizontal data merge combines data frames horizontally, i.e it adds columns to an existing data frame with the help of common column data(Ex: ID). It is only possible if both the data frames have the same set of observations. It basically adds columns to the existing data frame. In order to do that, both the data frames must have the same number of rows and the order of observations should be the same. If the rows are ordered inconsistently then the horizontal merge does not make any sense. So by making use of this data, lets answer the given question.

a.) Both data frames must have the same number of columns. - FALSE.

Having the same number of columns is not necessary but the order of observations is what makes it more important.

b.) Both data frames must have the same number of rows. - TRUE.

Because without the same number of rows two data frames cannot be merged horizontally.

c.) The data frames must have at least one column with values in common. - TRUE

Because the order of observations is important to merge data frames horizontally. So there should be at least one column shares the common values between them in order to merge. If there is no such common column, the R cannot understand how to merge.  

d.) The data frames must have at least one column with the same name. - TRUE

This is identically the same as above. There should be at least one column with the same name to merge. If there is no such common column with the same name, the R cannot understand how to merge.  

e.) Both data frames must have the same order of columns from left to right - FALSE.

Having the same order of columns from left to right is not necessary for merging data frames horizontally. But, that is a necessary condition for merging vertically.

The following is an example of merging data frames horizontally.

Data Frame 1

ID Name Score
1 Mohan 98
2 Abhi 99
3 Suresh 87

Data Frame 2

ID Test1 Test2 Test3
1 98 98 98
2 100 98 100
3 86 88 87

After Merging horizontally.

ID Name Score Test1 Test2 Test3
1 Mohan 98 98 98 98
2 Abhi 99 100 98 100
3 Suresh 87 86 88 87

#Please don't forget to upvote if you find the solution helpful. Feel free to ask doubts if any, in the comments section. Thank you.


Related Solutions

Which of the following statements about RFID is/are not true? (MULTIPLE ANSWERS) A. Can be used...
Which of the following statements about RFID is/are not true? (MULTIPLE ANSWERS) A. Can be used in inventory management B. Tolltag is an RFID transmitter C. Sending device requires power to be applied in order to transmit. D. Requires a reader device which receives radio signals produced by a sending device E. Used to identify and display radio station and media playing on radio.
Which of the following statements are true? Multiple answers: You can select more than one option...
Which of the following statements are true? Multiple answers: You can select more than one option A If unemployment benefits are increased¸ the minimum cost of a unit of effort for the employer will rise. B If the wage doesn’t change¸ employees will work harder in periods of high unemployment. C If workers continue to receive benefits however long they remained unemployed¸ an increase in the level of unemployment will have no effect on the best response curve. D If...
Which one of the following is considered a horizontal Merger? b. Ford merges with General Motors...
Which one of the following is considered a horizontal Merger? b. Ford merges with General Motors d. Socialism and Communism c. Ford merges with McDonalds a. Ford merges with Goodyear Tire
1. Which of the following statements are true regarding muscle glycogen. There are multiple correct answers....
1. Which of the following statements are true regarding muscle glycogen. There are multiple correct answers. If exercise is not to be repeated within 12 hours, then glycogen restoration does not have to be immediately following exercise The most rapid repletion of glycogen following exercise occurs in the first few hours post exercise. Consuming some protein along with carbohydrate during immediate recovery from exercise is beneficial. Higher glycemic index foods enhance glycogen restoration following exercise It is best to always...
Which of the following statements about utilization of a resource is TRUE? Multiple Choice  It is...
Which of the following statements about utilization of a resource is TRUE? Multiple Choice  It is at its maximum when the flow rate exceeds its capacity  It is at its maximum when the flow rate is equal to its capacity.  It is at its minimum when the flow rate exceeds its capacity. It is at its minimum when the flow rate is equal to its capacity 
Which of the following statements about recourse is (are) true? Multiple Choice The buyer of the...
Which of the following statements about recourse is (are) true? Multiple Choice The buyer of the mortgage can require the mortgage seller to repay the mortgage if the homeowner defaults. Most mortgage sales are with recourse. The homeowner can direct who the mortgage service provider is. The seller of the mortgage is responsible for the interest payments only. The mortgage seller must make all the monthly payments.
Which of the following is not true about Preferred Stock? Multiple Choice It typically pays a...
Which of the following is not true about Preferred Stock? Multiple Choice It typically pays a dividend that never changes. Preferred stock holders are ahead of bondholders in line to receive assets following a liquidation. Any missed dividends must be paid in full before a company can make dividend payments to holders of common stock. Its valuation can be determined by using the formula to value perpetuities. Not every company issues preferred stock. Which of the following is NOT true...
Which of the following is true about the origin of birds? Answers: Bird fossils from the...
Which of the following is true about the origin of birds? Answers: Bird fossils from the late cretaceous period show a loss of dinosaur characteristics. Feathers were first adapted for insulation and coevolved with endothermy. Archaeopteryx is an important "intermediate" between a dinosaur and a bird. They belonged to a group of bipedal dinosaurs called theropods.
Which is true for the sampling distribution of the sample mean (note multiple answers may be...
Which is true for the sampling distribution of the sample mean (note multiple answers may be correct)? A. The standard deviation for the sample mean is always less than the standard deviation for the underlying population that created the mean. B. The sample mean will only follow a normal distribution if the sample from which the mean was constructed is also a normal distribution. C. The sample mean will follow a normal distribution only if the sample constructing the mean...
Which of the following statements is TRUE about product costs? Multiple Choice A. Product costs are...
Which of the following statements is TRUE about product costs? Multiple Choice A. Product costs are reported only on the balance sheet. B. Product costs are reported only on the income statement. C. Product costs are reported on the balance sheet before goods are sold, and on the income statement after goods are sold. D. Product costs are reported on the income statement before goods are sold, and on the balance sheet after goods are sold.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT