为什么“摘要”不能在R中处理这些数据的线性模型?

时间:2015-07-23 18:29:21

标签: r

会话信息

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_1.0.0 dplyr_0.4.1   plyr_1.8.1   

loaded via a namespace (and not attached):
 [1] assertthat_0.1   colorspace_1.2-4 DBI_0.3.1        digest_0.6.4     formatR_1.2      grid_3.1.2      
 [7] gtable_0.1.2     htmltools_0.2.6  httpuv_1.3.2     knitr_1.10.5     lazyeval_0.1.10  magrittr_1.5    
[13] MASS_7.3-35      mime_0.2         munsell_0.4.2    packrat_0.4.3    parallel_3.1.2   proto_0.3-10    
[19] R6_2.0.1         Rcpp_0.11.5      reshape2_1.4     RJSONIO_1.3-0    scales_0.2.4     shiny_0.11.1    
[25] stringr_0.6.2    tools_3.1.2      xtable_1.7-4    

数据集

> dput(df)
structure(list(variation = c(0.626815828244532, 0.545797538497282, 
0.558226439404027, 0.427647726146102, 0.391128368954833, 0.509684115559787, 
0.910678839606448, 0.976563610753248, 0.937866096144771, 0.735154713808796, 
0.91378072555531, 0.655357590199441, 0.484736678245366, 0.500997654883741, 
0.278823718665372, 0.374523873110335, 0.407675893997702, 0.330964380968588, 
0.325030234744976, 0.127511226832626, 0.244836628421321, 0.292741376601331, 
0.0968514878662283, 0.258328273581007, 0.237981711587848, 0.275356267397724, 
0.192989933630191, 0.197390726795804, 0.375494359665328, 0.148781826718284, 
0.164998369719128, 0.0131814493967959, 0.0646749934321311, 0.134988818908056, 
0.0443586579648255, 0.0260330258977941, 0.104427121628245, 0.095582182403226, 
0.0806982957427736, 0.0440387421169708, 0.0274488611364823), 
    m.gapdist = c(13.3552750177431, 13.8087579617834, 12.6852272727273, 
    22.7146339347675, 21.8546590909091, 22.4446788990826, 32.9576445058197, 
    35.0773548387097, 33.1109944751381, 42.9548010939831, 42.1741743119266, 
    41.6259210526316, 53.0552433281005, 53.2622018348624, 52.36, 
    63.1930234335201, 62.962030075188, 64.6794736842105, 73.1398024591816, 
    73.045855513308, 72.79015625, 83.5571808028977, 84.142197309417, 
    83.6761111111111, 93.6386090990863, 90.9626446280992, 94.6396673596674, 
    102.235840326061, 101.741428571429, 102.936891891892, 112.357367974549, 
    112.767, 111.384594594595, 122.350092893637, 123.592105263158, 
    121.112941176471, 132.52527589545, 130.99125, 141.686573208723, 
    152.516842105263, 160.072)), row.names = c(1L, 2L, 3L, 5L, 
6L, 7L, 10L, 11L, 12L, 15L, 16L, 17L, 20L, 21L, 22L, 25L, 26L, 
27L, 30L, 31L, 32L, 34L, 35L, 36L, 39L, 40L, 41L, 44L, 45L, 46L, 
48L, 49L, 50L, 52L, 53L, 54L, 56L, 57L, 59L, 60L, 61L), class = "data.frame", .Names = c("variation", 
"m.gapdist"))

错误

> lmfit1 <- lm(variation ~ m.gapdist ,df)
> summary(lmfit1)
Error in summary.lm(lmfit1) : unused argument (lmfit1)

更新

我认为问题与记忆有关。我有9个数据集加载系统内存。删除所有数据并仅加载少量数据帧后,summary函数再次开始工作。

1 个答案:

答案 0 :(得分:1)

检查您的环境(通过运行ls())以确保您没有定义没有名为“summary.lm”的参数的函数。我发现“.GlobalEnv”显示在您的搜索列表上(首先是)可疑。错误消息与R一致,认为summary.lm没有参数。

在阅读Ben Bolker的评论后修改:对不起,我的术语使用不当。通过“在您的搜索列表上”,我的意思是find()报告的序列,而不是R会话的常规搜索列表。