2013-12-12 33 views
0

我试图通过两个变量ICPSR和会话合并到不同的data.frame共同赞助和控制。我把这条消息保存在FUN中。为什么会发生?这是两个数据的样子。我应该如何解决合并这两个数据集?在FUN中合并数据集时发生错误R

> str(cosponsors) 
'data.frame': 2242 obs. of 10 variables: 
$ ICPSR  : num 1077 2605 2605 2605 2605 ... 
$ session : num 103 103 104 105 106 107 103 103 103 103 ... 
$ dv   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ cd103  : num 4809 2616 2616 2616 2616 ... 
$ dem  : int 1 1 1 1 1 1 0 1 1 1 ... 
$ rep  : int 0 0 0 0 0 0 1 0 0 0 ... 
$ indep  : int 0 0 0 0 0 0 0 0 0 0 ... 
$ dw_nominate: num -0.44 -0.425 -0.424 -0.422 -0.421 -0.419 0.345 -0.355 -0.378 -0.32 ... 
$ iv   : num 0.262 0.229 0.229 0.229 0.229 ... 
$ yeaprop : num 0.25 0.25 1 0.571 0.4 ... 
> str(control) 
'data.frame': 2203 obs. of 3 variables: 
$ session: num 103 103 103 103 103 103 103 103 103 103 ... 
$ ICPSR : num 1077 2605 6455 6845 8080 ... 
$ evcent : num 0.0109 0.0189 0.039 0.0105 0.0673 0 0.000836 0.0706 0.0882 0.0517 ... 
> check<-merge(cosponsors, control, by("session", "ICPSR")) 
Error in FUN(X[[1L]], ...) : argument "FUN" is missing, with no default 

回答

0

你有某种错字。您使用的功能,而不是参数名称

尝试

check<-merge(cosponsors, control, by = c("session", "ICPSR")) 
+0

哎呀,我的错!非常感谢! – user3077008