So, as indicated in the header, I have two data sets:
data 1:
structure(list(Name = structure(c(18L, 19L, 5L, 13L, 14L, 31L ), .Label = c("AMC Javelin", "Cadillac Fleetwood", "Camaro Z28", "Chrysler Imperial", "Datsun 710", "Dodge Challenger", "Duster 360", "Ferrari Dino", "Fiat 128", "Fiat X1-9", "Ford Pantera L", "Honda Civic", "Hornet 4 Drive", "Hornet Sportabout", "Lincoln Continental", "Lotus Europa", "Maserati Bora", "Mazda RX4", "Mazda RX4 Wag", "Merc 230", "Merc 240D", "Merc 280", "Merc 280C", "Merc 450SE", "Merc 450SL", "Merc 450SLC", "Pontiac Firebird", "Porsche 914-2", "Toyota Corolla", "Toyota Corona", "Valiant", "Volvo 142E"), class = "factor"), mpg = c(145, 120, 150, 132, 110, 98), cyl = c(93, 116, 114, 156, 148, 167), disp = c(160, 160, 108, 258, 360, 225), hp = c(110, 110, 93, 110, 175, 105)), .Names = c("Name", "mpg", "cyl", "disp", "hp"), row.names = c(NA, 6L), class = "data.frame")
data 2:
structure(list(Name = structure(c(18L, 19L, 5L, 13L, 14L, 31L ), .Label = c("AMC Javelin", "Cadillac Fleetwood", "Camaro Z28", "Chrysler Imperial", "Datsun 710", "Dodge Challenger", "Duster 360", "Ferrari Dino", "Fiat 128", "Fiat X1-9", "Ford Pantera L", "Honda Civic", "Hornet 4 Drive", "Hornet Sportabout", "Lincoln Continental", "Lotus Europa", "Maserati Bora", "Mazda RX4", "Mazda RX4 Wag", "Merc 230", "Merc 240D", "Merc 280", "Merc 280C", "Merc 450SE", "Merc 450SL", "Merc 450SLC", "Pontiac Firebird", "Porsche 914-2", "Toyota Corolla", "Toyota Corona", "Valiant", "Volvo 142E"), class = "factor"), mpg_1 = c(125, 133, 143, 141, 134, 238), cyl_1 = c(114, 153, 112, 136, 128, 155), disp_1 = c(113, 143, 144, 131, 431, 331), hp_1 = c(332, 221, 113, 331, 134, 151)), .Names = c("Name", "mpg_1", "cyl_1", "disp_1", "hp_1"), row.names = c(NA, 6L), class = "data.frame")
I would like to calculate the ratio between the corresponding rows in the datasets. All values ββfrom the row (4 columns) should be used to calculate the relationship, and the ratio should be calculated between the data sets. Using a simpler explanation:
data1[1,2] / data2[1,2] data1[1,2] / data2[1,3] ... data1[1,3] / data2[1,2] ...
I would like to store the results in separate data with well-labeled columns to find out how the ratio was calculated.