`names`指向`by`

时间:2017-01-20 10:56:48

标签: r methods namespaces

以下事件发生在一个R会话中:

c("cyl", "mpg") %in% names(mtcars)
  

by.data.frame(mtcars)出错:

     缺少

参数“INDICES”,没有默认值

确实,调用names显示by

names
#function (data, INDICES, FUN, ..., simplify = TRUE) 
#UseMethod("by")
#<bytecode: 0x475e718>
#<environment: namespace:base>

调用base::names很好:function (x) .Primitive("names")

我通过单击RStudio的菜单选项重新启动了R会话,但它没有帮助。关闭RStudio(即names正确显示function (x) .Primitive("names"))并且我无法再重现此事。

这怎么可能发生?

我当时的会话(Freya是Ubuntu 14.04的分支):

sessionInfo()
# R version 3.3.2 (2016-10-31)
# Platform: x86_64-pc-linux-gnu (64-bit)
# Running under: elementary OS Freya
# 
# locale:
# [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
# [3] LC_TIME=cs_CZ.UTF-8        LC_COLLATE=en_US.UTF-8    
# [5] LC_MONETARY=cs_CZ.UTF-8    LC_MESSAGES=en_US.UTF-8   
# [7] LC_PAPER=cs_CZ.UTF-8       LC_NAME=C                 
# [9] LC_ADDRESS=C               LC_TELEPHONE=C            
# [11] LC_MEASUREMENT=cs_CZ.UTF-8 LC_IDENTIFICATION=C       
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] moodler_0.1 tidyr_0.6.0 dplyr_0.5.0
# 
# loaded via a namespace (and not attached):
# [1] lazyeval_0.2.0 magrittr_1.5   R6_2.2.0       assertthat_0.1 DBI_0.5-1     
# [6] tools_3.3.2    tibble_1.2     Rcpp_0.12.8    stringi_1.1.2  RMySQL_0.10.9 
# [11] openxlsx_3.0.0

1 个答案:

答案 0 :(得分:0)

这种情况最明显的方式,并且在RStudio中重新启动会话时仍然如此,只需在代码中的某个位置进行FBSDKLoginManager *loginMgr = [[FBSDKLoginManager alloc] init]; loginMgr.loginBehavior = FBSDKLoginBehaviorWeb; 分配。

然而,由于您无法复制,因此无法确定答案是否如此简单,或者分配是更复杂操作的结果。