R语言McSpatial_R语言中帮助和R包
#####获得帮助#####
#关于函数的帮助
help(glm)
?glm
#关于操作符的帮助
?`+`
#查看帮助文档中例子
example(glm)
#搜索主题
help.search("regression")
??regression
#library函数的帮助选项
library(help="grDevices")
#通过vignette查看指南文档,通过实际操作没反应
vignette("utils")
#已加载包的指南文件
vignette(all=FALSE)
#已安装包的指南文件
vignette(all=TRUE)
######R包#####
#类似于java中类
#列举本地库中R包
getOption("defaultPackags")
#已加载R包清单
(.packages())
#已安装的R包清单
(.packages(all.available=TRUE))
library()
#加载R包
library(rpart)
#搜索R包资源库:CRAN和Bioconductor
#可以通过界面也可以通过命令,建议通过界面的菜单来操作
#R控制台来安装R包
install.packages(c("tree","maptree"))
#移除R包
remove.packages(c("tree","maptree"))
输出
> #####获得帮助#####
> help(glm)
starting httpd help server ... done
> ?glm
> ?`+`
> example(glm)
glm> ## Dobson (1990) Page 93: Randomized Controlled Trial :
glm> counts
glm> outcome
glm> treatment
glm> print(d.AD
treatment outcome counts
1 1 1 18
2 1 2 17
3 1 3 15
4 2 1 20
5 2 2 10
6 2 3 20
7 3 1 25
8 3 2 13
9 3 3 12
glm> glm.D93
glm> anova(glm.D93)
Analysis of Deviance Table
Model: poisson, link: log
Response: counts
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 8 10.5814
outcome 2 5.4523 6 5.1291
treatment 2 0.0000 4 5.1291
glm> ## No test:
glm> summary(glm.D93)
Call:
glm(formula = counts ~ outcome + treatment, family = poisson())
Deviance Residuals:
1 2 3 4 5 6 7
-0.67125 0.96272 -0.16965 -0.21999 -0.95552 1.04939 0.84715
8 9
-0.09167 -0.96656
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.045e+00 1.709e-01 17.815 <2e-16 ***
outcome2 -4.543e-01 2.022e-01 -2.247 0.0246 *
outcome3 -2.930e-01 1.927e-01 -1.520 0.1285
treatment2 8.717e-16 2.000e-01 0.000 1.0000
treatment3 4.557e-16 2.000e-01 0.000 1.0000
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 10.5814 on 8 degrees of freedom
Residual deviance: 5.1291 on 4 degrees of freedom
AIC: 56.761
Number of Fisher Scoring iterations: 4
glm> ## End(No test)
glm>
glm> ## No test:
glm> ## an example with offsets from Venables & Ripley (2002, p.189)
glm> utils::data(anorexia, package = "MASS")
glm> anorex.1
glm+ family = gaussian, data = anorexia)
glm> summary(anorex.1)
Call:
glm(formula = Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian,
data = anorexia)
Deviance Residuals:
Min 1Q Median 3Q Max
-14.1083 -4.2773 -0.5484 5.4838 15.2922
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 49.7711 13.3910 3.717 0.000410 ***
Prewt -0.5655 0.1612 -3.509 0.000803 ***
TreatCont -4.0971 1.8935 -2.164 0.033999 *
TreatFT 4.5631 2.1333 2.139 0.036035 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 48.69504)
Null deviance: 4525.4 on 71 degrees of freedom
Residual deviance: 3311.3 on 68 degrees of freedom
AIC: 489.97
Number of Fisher Scoring iterations: 2
glm> ## End(No test)
glm>
glm> # A Gamma example, from McCullagh & Nelder (1989, pp. 300-2)
glm> clotting
glm+ u = c(5,10,15,20,30,40,60,80,100),
glm+ lot1 = c(118,58,42,35,27,25,21,19,18),
glm+ lot2 = c(69,35,26,21,18,16,13,12,12))
glm> summary(glm(lot1 ~ log(u), data = clotting, family = Gamma))
Call:
glm(formula = lot1 ~ log(u), family = Gamma, data = clotting)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.04008 -0.03756 -0.02637 0.02905 0.08641
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0165544 0.0009275 -17.85 4.28e-07 ***
log(u) 0.0153431 0.0004150 36.98 2.75e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for Gamma family taken to be 0.002446059)
Null deviance: 3.51283 on 8 degrees of freedom
Residual deviance: 0.01673 on 7 degrees of freedom
AIC: 37.99
Number of Fisher Scoring iterations: 3
glm> summary(glm(lot2 ~ log(u), data = clotting, family = Gamma))
Call:
glm(formula = lot2 ~ log(u), family = Gamma, data = clotting)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.05574 -0.02925 0.01030 0.01714 0.06371
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0239085 0.0013265 -18.02 4.00e-07 ***
log(u) 0.0235992 0.0005768 40.91 1.36e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for Gamma family taken to be 0.001813354)
Null deviance: 3.118557 on 8 degrees of freedom
Residual deviance: 0.012672 on 7 degrees of freedom
AIC: 27.032
Number of Fisher Scoring iterations: 3
glm> ## Not run:
glm> ##D ## for an example of the use of a terms object as a formula
glm> ##D demo(glm.vr)
glm> ## End(Not run)
glm>
glm>
> help.search("regression")
> ??regression
> library(help="grDevices")
> vignette("affy")
Warning message:
vignette ‘affy’ not found
> local({pkg
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> vignette("base")
Warning message:
vignette ‘base’ not found
> vignette(all=FALSE)
> vignette("utils")
Warning message:
vignette ‘utils’ not found
> vignette(all=FALSE)
> vignette('utils')
Warning message:
vignette ‘utils’ not found
> vignette(utils)
Error in vignette(utils) : object 'utils' not found
> vignette(all=TRUE)
> vignette(all=TRUE)
> #搜索主题
> vignette('colorspace')
Warning message:
vignette ‘colorspace’ not found
> vignette("colorspace")
Warning message:
vignette ‘colorspace’ not found
> getOption("defaultPackags")
NULL
> local({pkg
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> getOption("defaultPackags")
NULL
> utils:::menuInstallLocal()
Error in install.packages(choose.files("", filters = Filters[c("zip", :
no packages were specified
> utils:::menuInstallPkgs()
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
no packages were specified
> local({pkg
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
>
>
>
> library(utils)
> getOption("defaultPackags")
NULL
> (.packages())
[1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
[7] "base"
> vignette("utils")
Warning message:
vignette ‘utils’ not found
> vignette(all=FALSE)
> (.packages(all.available=TRUE))
[1] "base" "boot" "class" "cluster"
[5] "codetools" "colorspace" "compiler" "datasets"
[9] "dichromat" "digest" "foreign" "ggplot2"
[13] "graphics" "grDevices" "grid" "gtable"
[17] "KernSmooth" "labeling" "lattice" "MASS"
[21] "Matrix" "methods" "mgcv" "munsell"
[25] "nlme" "nnet" "parallel" "plyr"
[29] "proto" "RColorBrewer" "Rcpp" "reshape2"
[33] "Rlab" "rpart" "scales" "spatial"
[37] "splines" "stats" "stats4" "stringr"
[41] "survival" "tcltk" "tools" "utils"
> library()
> library(rpart)
> (.packages())
[1] "rpart" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "methods" "base"
> install.packages(c("tree","maptree"))
trying URL 'http://ftp.ctex.org/mirrors/CRAN/bin/windows/contrib/3.1/tree_1.0-35.zip'
Content type 'application/zip' length 117524 bytes (114 Kb)
opened URL
downloaded 114 Kb
trying URL 'http://ftp.ctex.org/mirrors/CRAN/bin/windows/contrib/3.1/maptree_1.4-7.zip'
Content type 'application/zip' length 115110 bytes (112 Kb)
opened URL
downloaded 112 Kb
package ‘tree’ successfully unpacked and MD5 sums checked
package ‘maptree’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\hui.qian\AppData\Local\Temp\Rtmpk3BoLc\downloaded_packages
> #移除R包
> remove.package(c("tree","maptree"))
Error: could not find function "remove.package"
> #移除R包
> remove.packages(c("tree","maptree"))
Removing packages from ‘D:/R/R-3.1.2/library’
(as ‘lib’ is unspecified)
>
R语言McSpatial_R语言中帮助和R包相关推荐
- R语言McSpatial_R语言天气可视化应用
前言 在很多人看来,R语言还只是个玩具,完全不具备企业级应用的能力.说这些话的人,根本就不了解R语言,更不清楚如何做企业级应用开发.从我最早接触R语言时,就把R做为可视化引擎嵌入到了晒粉丝的微博应用中 ...
- RStuido Server 选择不同的 R 版本(conda 中的不同 R 版本)
自从上一次服务器重装系统之后,总感觉缺少了一些东西,安装R包很多依赖库报错,也可以解决,但总是存在,烦. 一天,一个同事问我说ggpubr包安装不成功,我就自己试了一下,真的是--安装不成功. 当你到 ...
- python中 r什么意思_python中w、r指的是什么意思
python中w.r指的是什么意思 发布时间:2020-11-20 10:54:44 来源:亿速云 阅读:100 作者:小新 这篇文章将为大家详细讲解有关python中w.r指的是什么意思,小编觉得挺 ...
- R语言可视化图像中最常用的点样式(pch、plot characters)列表、ggpubr::show_point_shapes可视化最常用的点样式(pch)
R语言可视化图像中最常用的点样式(pch.plot characters)列表.ggpubr::show_point_shapes可视化最常用的点样式(pch) 目录
- R语言text函数在R原生可视化结果中添加文本标签、内容:指定文本显示的位置、颜色、字体大小等(Position、Change Color 、 Size of Text)
R语言text函数在R原生可视化结果中添加文本标签.内容:指定文本显示的位置.颜色.字体大小等(Position.Change Color . Size of Text) 目录
- R语言应用calibrate包的textxy函数向R原生绘图结果中添加文本标签:添加多个文本标签、改变文本标签的字体、改变文本标签的字体颜色
R语言应用calibrate包的textxy函数向R原生绘图结果中添加文本标签:添加多个文本标签.改变文本标签的字体.改变文本标签的字体颜色 目录
- R语言在ggplot中使用变量指定柱状图的名称实战
R语言在ggplot中使用变量指定柱状图的名称实战 目录 R语言在ggplot中使用变量指定柱状图的名称实战
- R语言把dataframe中的NA值替换为0
R语言把dataframe中的NA值替换为0 目录 R语言把dataframe中的NA值替换为0 缺失值替换 方法总结 缺失值替换
- 在R语言环境中无法载入rJava包的解决办法
问题描述: 安装包xlsx包后,运行library("xlsx")后弹出错误窗口: RGui (64-bit): Rgui.exe - 系统错误 无法启动此程序,因为计算机中丢失 ...
最新文章
- 更新!带你认识推荐系统全貌的论文清单
- 服务器信息采集协议,服务器信息采集
- POJ 1523 SPF 割点与桥的推断算法-Tarjan
- JS引用类型(2)——Array类型
- 第0周学习资源阅读感悟
- wpf 如何设置弹出窗口必须关闭才能打开其他软件_CAD如何打印才能不留白?原来打印图纸还有这么多技巧?...
- SLAM Cartographer(16)约束构建器
- ios 数组中的字典排序_题解 | 26.删除排序数组中的重复项
- 西瓜书+实战+吴恩达机器学习(十五)无监督学习之关联分析(Apriori, FP-growth)
- (翻译)开始iOS 7中自动布局教程(二)
- linux内核启动后键盘不能用,编译linux-0.11内核后键盘不对的问题解决方法,比如/变成了-...
- 非法关机linux分辨率丢失,非法关机造成文件系统损坏,怎么办?请教:附图片...
- vs2012配置opengl提示error lnk
- 计算机网络数据传输的,计算机网络数据传输技术基本概念
- Eclipse中出现无法找到Maven包Active Maven Profiles (comma separated)
- 在腾讯云上搭建基于Nodejs的网站
- Duilib嵌入cef3,实现浏览器功能
- Ambarella处理器启动过程
- 【综合算法】不考虑误差的TDOA定位
- 解决WIN10播放AVI等格式视频黑屏只有声音的问题
热门文章
- FDM打印机使用总结(一)
- MQClientException The producer service state not OK, CREATE_JUST
- JavaScript的NaN为什么不等于NaN
- 国标28181:什么是SDP协议
- PHOTOSHOP CS打造素描MM
- 2016年下半年总结(连载)!
- java是什么?带你了解
- 2021-07-09 终值定理和稳态误差【自动控制原理】
- ROS之msg文件定义以及自定义发布主题消息类型
- jupyterlab:Failed to load the jupyterlab-git server extension问题如何解决?