Displaying 1 result from an estimated 1 matches for "country_a".
Did you mean:
country_b
2009 Mar 19
1
simple "for loop" program for merging datasets?
...cal predictor “country”.
Dataset A:
Country Measure1
Afganistan 1
Afganistan 1
Russia 5
Poland 3
Poland 2
Dataset B:
Country Measure 2
Russia 2
Afganistan 10
Poland 15
My program does not work:
Country_A<-A$Country
Country_B<-B$Country
Measure2<-B$Measure2
for(i in 1:nrow(B)){
for(j in 1:nrow(A){
w[j]<-ifelse(Country_A[j]= =(Country_B[i]),Measure2[i], NA)
}}
A2<-cbind(B,w)
Thanks, Julia
_________________________________________________________________
[[alternative HTML ve...