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的更多相关文章

  1. 18/07/2017 R matrix

    矩阵:二维数组,元素拥有相同模式(数值型,字符型或者逻辑型) mymatrix <- matrix (vector, nrow_num_of_rows, ncol_num_of_columns, ...

  2. ArcEngine中打开各种数据源(WorkSpace)的连接http://www.cnblogs.com/feilong3540717/archive/2011/08/07/2129906.html

    ArcEngine中打开各种数据源(WorkSpace)的连接 ArcEngine中打开各种数据源(WorkSpace)的连接 (SDE.personal/File.ShapeFile.CAD数据.影 ...

  3. 新手C#异常的学习2018.08.07

    异常是在程序执行期间出现的问题.C# 中的异常是对程序运行时出现的特殊情况的一种响应,比如尝试除以零. class Program { static void Main(string[] args) ...

  4. 2016.08.07计算几何总结测试day2

    T1 bzoj: [Usaco2010 OPen]Triangle Counting 数三角形 看到这个题n那么大, 于是想到极角排序搞一搞,然而排完序后立马懵逼,完全不知道接下来应该怎么写.... ...

  5. (数据科学学习手札07)R在数据框操作上方法的总结(初级篇)

    上篇我们了解了Python中pandas内封装的关于数据框的常用操作方法,而作为专为数据科学而生的一门语言,R在数据框的操作上则更为丰富精彩,本篇就R处理数据框的常用方法进行总结: 1.数据框的生成 ...

  6. ZROI 19.08.07模拟赛

    传送门 写在前面:为了保护正睿题目版权,这里不放题面,只写题解. "正睿从来没有保证,模拟赛的题目必须原创." "文案不是我写的,有问题找喵老师去."--蔡老师 ...

  7. January 07 2017 Week 1st Saturday

    Procrastination is the thief of time. 拖延乃是光阴之窃贼. My parents always tell me that things ought to be d ...

  8. FPGA學習筆記(肆)--- Star Test Bench Template Writer

    上一篇testbench我自己也沒怎麽搞懂,再來一篇學習特權同學的方法. 課程:Lesson 7 BJ EPM240学习板实验1——分频计数实验 鏈接:https://www.youtube.com/ ...

  9. git log的常见用法

    git log 使用git log命令,什么参数都没有的话,会以下面的格式输出所有的日志(我当前的git仓库只有三个提交).如果日志特别多的话,在git bash中,按向下键来查看更多,按q键退出查看 ...

随机推荐

  1. 二开获取yigo设计器里查询集合里中的某个SQL

    package com.bokesoft.lrp_v3.mid.dongming.service; import java.math.BigDecimal; import java.util.Arra ...

  2. keil-rtx

    OS:任务级设计,任务间耦合小:改变裸机前后台设计方案中后台任务轮训无优先级重要任务得不到确定性响应:伪并行,提高利用率. 在keilv4.74最后一个版本之后,KIELV5将KEIL-RTX该为CM ...

  3. 微服务实践分享(2)api网关

    1.作用[http://chuansong.me/n/465796751848]: 一个完整的.「面向接入」的API GW需要包含以下功能: 面向运行期 对客户端实现身份认证 通信会话的秘钥协商,报文 ...

  4. 值类型 VS 引用类型~

    问     题 值  类  型 引 用 类 型 这个类型分配在哪里? 分配在栈上 分配在托管堆上 变量是怎么表示的? 值类型变量是局部复制 引用类型变量指向被分配得实例所占的内存 基类型是什么? 必须 ...

  5. P4878 道路修建-美国

    http://www.tyvj.cn/p/4878道路修建 我想我经大神点拨后终于明白了...回学校再写吧 时间限制:1s 内存限制:256MB [问题描述] A国是一个商业高度发达的国家.它包含了n ...

  6. tyvj P4877 _1.组合数

    时间限制:1s 内存限制:256MB [问题描述] 从m个不同元素中,任取n(n≤m)个元素并成一组,叫做从m个不同元素中取出n个元素的一个组合:从m个不同元素中取出n(n≤m)个元素的所有组合的个数 ...

  7. Java @Validated 遇到的大坑

    我在一个Controller内,在两个方法内使用@Validated,这是两个POST方法会进入的方法,这两个方法的实体类的命名(下图红框内容)不能一样,一样的话就会导致第二个在页面显示不出来错误信息 ...

  8. B/S架构 C/S架构 SOA架构

    一.什么是C/S和B/S 第一.什么是C/S结构.C/S (Client/Server)结构,即大家熟知的客户机和服务器结构.它是软件系统体系结构,通过它可以充分利用两端硬件环境的优势,将任务合理分配 ...

  9. Kendo UI 移动应用开发简介

    Kendo UI 移动应用开发简介 Kendo UI 支持开发 Web 应用,前面介绍的 SPA,也支持开发移动应用,至于使用 HTML5 + JavaScript + CSS 开发移动是不是一个好的 ...

  10. Kendo MVVM 数据绑定(四) Disabled/Enabled

    Kendo MVVM 数据绑定(四) Disabled/Enabled Disabled 和 Enabled 绑定可以根据 ViewModel 的某个属性值的 true,false 来设置 DOM 元 ...