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. 前端JavaScript(1) --Javascript简介,第一个JavaScript代码,数据类型,运算符,数据类型转换,流程控制,百度换肤,显示隐藏

    一.Javascript简介 Web前端有三层: HTML:从语义的角度,描述页面结构 CSS:从审美的角度,描述样式(美化页面) JavaScript:从交互的角度,描述行为(提升用户体验) Jav ...

  2. net Core 2.0应用程序发布到IIS

    .net Core 2.0应用程序发布到IIS上注意事项   .net Core2.0应用程序发布window服务器报错容易错过的配置. 1.应用程序发布. 2.IIS上新建网站. 3.应用程序池选择 ...

  3. NetCore组件

    NetCore之组件写法 本章内容和大家分享的是Asp.NetCore组件写法,在netcore中很多东西都以提供组件的方式来使用,比如MVC架构,Session,Cache,数据库引用等: 这里我也 ...

  4. Zeppelin的入门使用系列之使用Zeppelin来创建临时表UserTable(三)

    不多说,直接上干货! 前期博客 Zeppelin的入门使用系列之使用Zeppelin运行shell命令(二) 我们必须要先使用Spark 语句创建临时表UserTable,后续才能使用Spark SQ ...

  5. Centos安装TensorFlow和Keras

    安装命令如下: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py pip install tensor ...

  6. Spring Security在标准登录表单中添加一个额外的字段

    概述 在本文中,我们将通过向标准登录表单添加额外字段来实现Spring Security的自定义身份验证方案. 我们将重点关注两种不同的方法,以展示框架的多功能性以及我们可以使用它的灵活方式. 我们的 ...

  7. PHP+Mysql+jQuery找回密码

    通常所说的密码找回功能不是真的能把忘记的密码找回,因为我们的密码是加密保存的,一般开发者会在验证用户信息后通过程序生成一个新密码或者生成一个特定的链接并发送邮件到用户邮箱,用户从邮箱链接到网站的重置密 ...

  8. 微信小程序tabBar显示问题

    在微信小程序的开发中,我遇到疑惑如下: 在app.json中定义了多个pages,一般微信小程序启动的时候,自动加载pages下的第一个页面, "pages": [        ...

  9. 仙人掌(cactus)

    题目描述LYK 在冲刺清华集训(THUSC)!于是它开始研究仙人掌,它想来和你一起分享它最近研究的结果.如果在一个无向连通图中任意一条边至多属于一个简单环(简单环的定义为每个点至多经过一次),且不存 ...

  10. JSONModel 简单例子

    // ProductModel.h // JSONModel // // Created by 张国锋 on 15/7/20. // Copyright (c) 2015年 张国锋. All righ ...