I have two separate databases (Database_1 and Database_2) I want to add the height profile from Database_2 to Database_1 as a new column in Database_1.
Database_1:
Horse_type
Stallion
Race_horse
Work_horse
Work_horse
Database_2:
Horse_type Height_profile
Stallion Large
Race_horse Medium
Work_horse Small
Pure_breed Huge
So far I've only tried to do this using a for loop.
for (row in 1:nrow(Database_1)) {
if(Database_1$Horse_type == Database_2$Horse_type) {
Database_1$New_Column <- Database_2$height_profile
}
}
I expect the output:
Database_1:
Horse_type Height_profile
Stallion Large
Race_horse Medium
Work_horse Small
Work_horse Small
But the actual output is:
"There were 50 or more warnings (use warnings() to see the first 50)"