I'm a newbie in R (and programming in general) and need some help:
I want to transfer certain values from one csv file to another. csv1 and csv2 both have 3 columns: "A", "B", "value" of which "A" and "B" are strings. For those rows in csv2 which have the same strings as in csv1 (so A+B in csv1 = A+B in csv2) I want to transfer the values from csv1, otherwise I want to have "na" as an output.
What I did so far (and it might make absolutely no sense):
if (csv1$A == csv2$A & csv1$B == csv2$B) {
print(csv1$value for csv2$value) ### I obviously can't use "for"!
else
print ("na")
}
}
Thank you very much for your help! (I apologize for my lack of programming skills...)