08/07/2017 R
from today,i will learn something about the R.
install R studio
code:
1.>install.packages("swirl")
>library(swirl)##this sentence just for using of the swirl package.
>swirl()##for the beginning of the swirl
2.select the basic building blocks. If at any point you'd like more information on a paticular topic,you can type the help.start() at the prompt. when you input
"help.start()",there are some resources for you about the problem. (at some moment ,i i will try it )
R can be used as a simple caculatorjust like " > 5 + 7",then press the enter,you will get the result.
x <- 5 + 7.#there is a single space between two elements(<- is one element).And at this time, R thinks that you do not use the result immediately.so,when you write the x <- 5 + 7,and then you put the enter button,there is not a result.if you want a result ,you should write down the x,then click(press) the enter button.In other words,to view the contents of the variable x,just type x and press enter.
Then type y <- x - 3. then type y,you will find that the result is 9. so x and y can be used in the next time because they are variables.
To create a vector(a small collection of numbers),please type c(),which stands for "concatenate" or "combination".For example,To create a vector that containing the numbers 1.1,9 and 3.14,type c(1.1,9,3.14).
3.any time you have some questions about a particular function,for example ,you want to get more information about the c(),,just type ?c.
>z <- c(1.1,9,3.4)#make a vector and z stores the result.
type z to view its contents. The result is like that 1.10 9.00 3.14. Notice that there are no commas seperating the values in the output.
And you can combine the vetors to make a new vector.For example,type c (z,5.55) ,the result is like that 1.10 9.00 3.14 5.55.
> z * 2 + 100 #Firstly,R mutiplied each of the 3 elements in z by 2..Then it added 100 to each of the elements.
the result of the sqrt(z) is the same as z0.5.
my_sqrt <- sqrt(z-1) my_div <- z / my_sqrt. the result of this format is that the first element of my_div is equal to the first element of z divided by the first element of my_sqrt,and so on...
when you ask R to compute Z * 2 + 100,what it really compute is this :z * c(2,2,2) + c(100,100,100).
When you ask R to compute c(1,2,3,4) + c(0,2)(try),the result is 1 4 3 6
when you ask R to compute c(1,2,3,4) + c(1,2,3),the result is 2 4 7 5 and a waring (because the 3 is not enoug to recycle ).
08/07/2017 R的更多相关文章
- 18/07/2017 R matrix
矩阵:二维数组,元素拥有相同模式(数值型,字符型或者逻辑型) mymatrix <- matrix (vector, nrow_num_of_rows, ncol_num_of_columns, ...
- ArcEngine中打开各种数据源(WorkSpace)的连接http://www.cnblogs.com/feilong3540717/archive/2011/08/07/2129906.html
ArcEngine中打开各种数据源(WorkSpace)的连接 ArcEngine中打开各种数据源(WorkSpace)的连接 (SDE.personal/File.ShapeFile.CAD数据.影 ...
- 新手C#异常的学习2018.08.07
异常是在程序执行期间出现的问题.C# 中的异常是对程序运行时出现的特殊情况的一种响应,比如尝试除以零. class Program { static void Main(string[] args) ...
- 2016.08.07计算几何总结测试day2
T1 bzoj: [Usaco2010 OPen]Triangle Counting 数三角形 看到这个题n那么大, 于是想到极角排序搞一搞,然而排完序后立马懵逼,完全不知道接下来应该怎么写.... ...
- (数据科学学习手札07)R在数据框操作上方法的总结(初级篇)
上篇我们了解了Python中pandas内封装的关于数据框的常用操作方法,而作为专为数据科学而生的一门语言,R在数据框的操作上则更为丰富精彩,本篇就R处理数据框的常用方法进行总结: 1.数据框的生成 ...
- ZROI 19.08.07模拟赛
传送门 写在前面:为了保护正睿题目版权,这里不放题面,只写题解. "正睿从来没有保证,模拟赛的题目必须原创." "文案不是我写的,有问题找喵老师去."--蔡老师 ...
- January 07 2017 Week 1st Saturday
Procrastination is the thief of time. 拖延乃是光阴之窃贼. My parents always tell me that things ought to be d ...
- FPGA學習筆記(肆)--- Star Test Bench Template Writer
上一篇testbench我自己也沒怎麽搞懂,再來一篇學習特權同學的方法. 課程:Lesson 7 BJ EPM240学习板实验1——分频计数实验 鏈接:https://www.youtube.com/ ...
- git log的常见用法
git log 使用git log命令,什么参数都没有的话,会以下面的格式输出所有的日志(我当前的git仓库只有三个提交).如果日志特别多的话,在git bash中,按向下键来查看更多,按q键退出查看 ...
随机推荐
- 每天学点Linux命令之grep 和 wc命令 --- !管道命令!
Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来.grep全称是Global Regular Expr ession Print,表示全局正则表 ...
- Log4j输出格式log4j的PatternLayout参数含义
摘自:http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html 参数 说明 例子 %c 列出logger ...
- Servlet中文件上传的几种方式
上传文件,因为上传的都是二进制数据,所以在Servlet中就不能直接用request.getParameter();方法进行数据的获取,需要借助第三方jar包对上传的二进制文件进行解析.常用的方式如下 ...
- css:hover伪类的使用
:hover的使用,即当鼠标指针移入元素时,所做出的样式设置 示例一 <!DOCTYPE html> <html lang="en"> <head&g ...
- (2017.10.10) 我对 JavaScript 历史的认识
关于 JavaScript 的历史和来由相信学过 JavaScript 的小伙伴都能说出一二.我看过一些入门书籍第一章或者前言部分都有介绍,但是一直没捋清这段历史.今天通过两个问题,来加深我对 Jav ...
- 零基础逆向工程12_C语言06_switch语句反汇编
12_C语言06_switch语句反汇编 switch语句反汇编 测试环境:VC++6.0 分支少于4的时候没有意义,编译器会生成类似if...else之类的反汇编,不超过三个分支,不会生成索引表. ...
- 读写属性/if判断那点事/数组
读写属性属性操作注意事项 js中不允许出现"-".所以font-size变成fontSize/margin-top变成marginTop. Op.style.with=" ...
- mac不限速下载百度网盘
本文转载自:https://blog.csdn.net/u010837612/article/details/80029212 相信大家都比较困惑,百度网盘客户端限速后一般只有几十K的下载速度,Win ...
- Windows Azure 配置Active Directory 主机(2)
前一篇概况给大家介绍了,在云端部署一台DC 需要满足一些条件,接下来进入正题,云端VM安装域控制器具体步骤. 步骤1 :验证 主DC 的静态 IP 地址 1.登录到 Corp 网络上的 主DC. 2. ...
- SqlServer自定义排序
在实际项目中,有时会碰到数据库SQL的特殊排序需求,举几个例子,作为参考. 1.自定义优先级 一种常见的排序需求是指定某个字段取值的优先级,根据指定的优先级展示排序结果.比如如下表: Create T ...