Deloitte Interview Questions | What are the ways in which you can combine multiple sets into one?

Question

R

in progress 0
TheDataMonk 55 years 1 Answer 961 views Grand Master 0

Answer ( 1 )

  1. By adding columns: If the two sets of data have an equal set of rows, and the order of the rows is identical, then adding columns makes sense. Your options for doing this are data.frame or cbind().

    By adding rows: If both sets of data have the same columns and you want to add rows to the bottom, use rbind().

    By combining data with different shapes: The merge() function combines data based on common columns, as well as common rows. In databases language, this is usually called joining data.

Leave an answer

Browse
Browse