学习小组Day5笔记——单双
2018-08-25 本文已影响21人
丹keepbetter
今天学习的主要内容:
-
R 和 RStudio 的安装
-
RStudio 界面的了解,初级设置
-
RStudio 的简单操作
R语言是比较常用的统计分析和绘图语言,拥有强大的统计库、绘图库和生信分析的Bioconductor库,是学习生物信息分析的必备语言之一。
![](https://img.haomeiwen.com/i13695391/9d3c5906e256c523.png)
Rstudio 是 编辑、运行——R语言的最为理想的工具之一,支持纯R脚本、Rmarkdown (脚本文档混排)、Bookdown (脚本文档混排成书)、Shiny (交互式网络应用)等。
R 和 Rstudio 的下载与安装
https://mirrors.tuna.tsinghua.edu.cn/CRAN/“R”
https://www.rstudio.com/products/rstudio/download/"Rstudio"
注意: 安装前要把电脑用户名改为英文
RStudio 界面
- 1 代码窗口——今天没有用到,还不知道是干什么的
- 2 控制台——交互窗口,输入输出都在此
- 3 ?——对象及信息,历史 会在这里
-
4 ?——文件目录,图,包 在这里
Rstudio窗口.png
RStudio简单设置
RStudio初步应用
简单图练习:plot(runif(50))——plot()函数是R中基本的画x-y两个变量的函数;runif(50)函数用于生成50个从0到1区间范围内的服从正态分布的随机数,x就是50个数的序数,y就是这50个数的值。
基本操作:getwd() setwd()list.files() dir() rm() <- history 等
遇到的问题:
命令要准确
> list.file()
Error in list.file() : could not find function "list.file"
> list.files()
character(0)
history() 命令
第一遍正确
后来怎么输入都没有反应,不知道问题出在哪里?
> HISTORY()
Error in HISTORY() : could not find function "HISTORY"
> history
function (...)
.rs.callAs(name, hook, original, ...)
<environment: 0x000000000d623d08>
> history()
> history(5)
> history(10)
> history()
> history()
save.image
这是存下了吗,存到哪里了呀
> save.image
function (file = ".RData", version = NULL, ascii = FALSE, compress = !ascii,
safe = TRUE)
{
if (!is.character(file) || file == "")
stop("'file' must be non-empty string")
opts <- getOption("save.image.defaults")
if (is.null(opts))
opts <- getOption("save.defaults")
if (missing(safe) && !is.null(opts$safe))
safe <- opts$safe
if (missing(ascii) && !is.null(opts$ascii))
ascii <- opts$ascii
if (missing(compress) && !is.null(opts$compress))
compress <- opts$compress
if (missing(version))
version <- opts$version
if (safe) {
outfile <- paste0(file, "Tmp")
i <- 0
while (file.exists(outfile)) {
i <- i + 1
outfile <- paste0(file, "Tmp", i)
}
}
else outfile <- file
on.exit(file.remove(outfile))
save(list = names(.GlobalEnv), file = outfile, version = version,
ascii = ascii, compress = compress, envir = .GlobalEnv,
precheck = FALSE)
if (safe)
if (!file.rename(outfile, file)) {
on.exit()
stop(gettextf("image could not be renamed and is left in %s",
outfile), domain = NA)
}
on.exit()
}
<bytecode: 0x0000000005e4a258>
<environment: namespace:base>
关于[1] 代表什么,两个值在两行怎么都是1呀?
> ls(d,x)
character(0)
> ls.str()
d : num 11
x : num 3
> d
[1] 11
> x
[1] 3
![](https://img.haomeiwen.com/i13695391/2305bc1713f10aa5.png)
结语:
通过简单实用的教程胆战心惊的成功下载安装了R和RStudio, 并学习了些基本操作,从前觉得像天数般的东西通过键盘就活生生的呈现在自己面前,学习新东西的过程中因为有前人的精心教程和指导而异常顺利,而顺利的学习新知识很解压并对自己重树信心,感谢+1!