I'm having a problem with merge()
I have two data frames, one that I imported from SPSS (ssfia) and one that I created on my own. The latter contains a variable indexing the degree of overlap between two variables in the former.
match<-ifelse(ssfia$Func_Source==ssfia$Symptom_Source,1,0)
I want to merge this new "match" variable by "ID" the SPSS dataset (ssfia), so I made a data frame with ID and my new Match variable.
matchf<-data.frame(match,ssfia$ID)
Now I try to merge them...
merge(ssfia,matchf,by="ID")
And it gives me the following error:
Error in fix.by(by.y, y) : 'by' must specify uniquely valid column(s)
I tried searching this site for similar problems, but everyone else seems to have a more nuanced issue. I'm guessing this will be something pretty simple. Any help would be greatly appreciated!
As noted in the comments, that column probably doesn't exist in
matchf
. Try:Then re-run the merge.