- 浏览: 2501449 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Rlang(1)Introduction and Installation - Calculate and Load Data
Install R Script
Download the file from here http://www.go-parts.com/mirrors-usa/cran/, I get the version R-3.2.2.pkg.
Install Pandoc - Tool to Convert md to Documents
Download the latest package from here https://github.com/jgm/pandoc/releases/tag/1.15.0.6, I get the version pandoc-1.15.0.6-osx.pkg
Follow the docs here http://dapengde.com/r4dummies
1. Introduction
We use R language to do data process, draw diagram and programming.
Anyone can R - anyone can Er/2, haha.
I already install R-3.2.2.pkg, Need I install https://www.rstudio.com/products/rstudio/download/, RStudio, it is a nice tool.
After I install R-3.2.2.pkg, I can verify the version using following command.
> r --version
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
2. Use R to do Calculation
Create a new R script file on Rsutdio, it will create a file named similar to Calculate.R, end with .R.
3 * (2 + 2)
sqrt(9)
## comments here.
Some other useful functions, round(), trunc(), sort(), abs(), exp(), log(), log10(), sin(), cos(), tan(), sin(), cos(), tan().
pi
## 3.141593
> options(digits=22)
> pi
[1] 3.141592653589793115998
> options(digits = 3)
> x <- c(61, 45, 55, 46, 56, 79, 86, 57, 56, 56, 57, 71)
> x[4]
[1] 46
Operation on x
> x + 100
[1] 161 145 155 146 156 179 186 157 156 156 157 171
These commands will directly draw the diagram for us.
options(digits = 3)
x <- c(61, 45, 55, 46, 56, 79, 86, 57, 56, 56, 57, 71)
x[4]
x + 100
plot(x)
## calculate the average
sum(x)/length(x)
mean(x)
Some other useful functions provided by R language, sum(), mean(), max(), min(), range(), median(), sd(), var().
3. Manage the Data from File
Reading the document from here http://dapengde.com/archives/14818, Download the sample data file from here
http://dapengde.com/wp-content/uploads/2013/03/dapengde_DummyR_PM25.csv
Put this in the command console, you will see the help information for read.table
>?read.table
This will read the file directly and open the file with default application
mydata <- "/opt/data/dapengde_DummyR_PM25.csv"
mydata
file.show(mydata)
load the csv data directly from file
mydata <- "/opt/data/dapengde_DummyR_PM25.csv"
mydata
##file.show(mydata)
#pm <- read.table(file=mydata, header = TRUE, sep=",")
pm <- read.csv(file=mydata)
The command summary will display a very useful information about the data
> summary(pm)
time h8 h100 h325
Min. : 0.00 Min. : 46.0 Min. : 32.0 Min. : 30.0
1st Qu.: 5.75 1st Qu.: 75.5 1st Qu.: 48.0 1st Qu.: 42.8
Median :11.50 Median : 93.5 Median : 67.5 Median : 54.5
Mean :11.50 Mean : 98.7 Mean : 72.1 Mean : 65.5
3rd Qu.:17.25 3rd Qu.:128.0 3rd Qu.:100.0 3rd Qu.: 88.5
Max. :23.00 Max. :150.0 Max. :123.0 Max. :126.0
1st Qu and 3rd Qu
https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%88%86%E4%BD%8D%E6%95%B0
Get the row 10, column 2 data.
> pm[10, 2]
[1] 150
Pick up the C array of data with column 2
> pm[c(0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22), 2]
[1] 80 91 100 144 150 106 68 46 68 92 108
Generate the seq from seq()
> pm[seq(0,22,2),2]
[1] 80 91 100 144 150 106 68 46 68 92 108
All data belong to column 2
> pm[,2]
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
Pick up the column H8
> pm[, "h8"]
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
Similar to the command above
> pm$h8
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
List the Column Name
> names(pm)
[1] "time" "h8" "h100" "h325"
References:
http://www.go-parts.com/mirrors-usa/cran/
https://www.r-project.org/
http://www.biosino.org/R/R-doc/files/R4beg_cn_2.0.pdf
https://github.com/yihui/r-ninja
http://pandoc.org/
http://dapengde.com/r4dummies
http://dapengde.com/archives/14802
Install R Script
Download the file from here http://www.go-parts.com/mirrors-usa/cran/, I get the version R-3.2.2.pkg.
Install Pandoc - Tool to Convert md to Documents
Download the latest package from here https://github.com/jgm/pandoc/releases/tag/1.15.0.6, I get the version pandoc-1.15.0.6-osx.pkg
Follow the docs here http://dapengde.com/r4dummies
1. Introduction
We use R language to do data process, draw diagram and programming.
Anyone can R - anyone can Er/2, haha.
I already install R-3.2.2.pkg, Need I install https://www.rstudio.com/products/rstudio/download/, RStudio, it is a nice tool.
After I install R-3.2.2.pkg, I can verify the version using following command.
> r --version
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
2. Use R to do Calculation
Create a new R script file on Rsutdio, it will create a file named similar to Calculate.R, end with .R.
3 * (2 + 2)
sqrt(9)
## comments here.
Some other useful functions, round(), trunc(), sort(), abs(), exp(), log(), log10(), sin(), cos(), tan(), sin(), cos(), tan().
pi
## 3.141593
> options(digits=22)
> pi
[1] 3.141592653589793115998
> options(digits = 3)
> x <- c(61, 45, 55, 46, 56, 79, 86, 57, 56, 56, 57, 71)
> x[4]
[1] 46
Operation on x
> x + 100
[1] 161 145 155 146 156 179 186 157 156 156 157 171
These commands will directly draw the diagram for us.
options(digits = 3)
x <- c(61, 45, 55, 46, 56, 79, 86, 57, 56, 56, 57, 71)
x[4]
x + 100
plot(x)
## calculate the average
sum(x)/length(x)
mean(x)
Some other useful functions provided by R language, sum(), mean(), max(), min(), range(), median(), sd(), var().
3. Manage the Data from File
Reading the document from here http://dapengde.com/archives/14818, Download the sample data file from here
http://dapengde.com/wp-content/uploads/2013/03/dapengde_DummyR_PM25.csv
Put this in the command console, you will see the help information for read.table
>?read.table
This will read the file directly and open the file with default application
mydata <- "/opt/data/dapengde_DummyR_PM25.csv"
mydata
file.show(mydata)
load the csv data directly from file
mydata <- "/opt/data/dapengde_DummyR_PM25.csv"
mydata
##file.show(mydata)
#pm <- read.table(file=mydata, header = TRUE, sep=",")
pm <- read.csv(file=mydata)
The command summary will display a very useful information about the data
> summary(pm)
time h8 h100 h325
Min. : 0.00 Min. : 46.0 Min. : 32.0 Min. : 30.0
1st Qu.: 5.75 1st Qu.: 75.5 1st Qu.: 48.0 1st Qu.: 42.8
Median :11.50 Median : 93.5 Median : 67.5 Median : 54.5
Mean :11.50 Mean : 98.7 Mean : 72.1 Mean : 65.5
3rd Qu.:17.25 3rd Qu.:128.0 3rd Qu.:100.0 3rd Qu.: 88.5
Max. :23.00 Max. :150.0 Max. :123.0 Max. :126.0
1st Qu and 3rd Qu
https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%88%86%E4%BD%8D%E6%95%B0
Get the row 10, column 2 data.
> pm[10, 2]
[1] 150
Pick up the C array of data with column 2
> pm[c(0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22), 2]
[1] 80 91 100 144 150 106 68 46 68 92 108
Generate the seq from seq()
> pm[seq(0,22,2),2]
[1] 80 91 100 144 150 106 68 46 68 92 108
All data belong to column 2
> pm[,2]
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
Pick up the column H8
> pm[, "h8"]
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
Similar to the command above
> pm$h8
[1] 97 80 64 91 87 100 128 144 150 150 150 106 78 68 62 46 55 68 84 92 95
[22] 108 128 138
List the Column Name
> names(pm)
[1] "time" "h8" "h100" "h325"
References:
http://www.go-parts.com/mirrors-usa/cran/
https://www.r-project.org/
http://www.biosino.org/R/R-doc/files/R4beg_cn_2.0.pdf
https://github.com/yihui/r-ninja
http://pandoc.org/
http://dapengde.com/r4dummies
http://dapengde.com/archives/14802
发表评论
-
NodeJS12 and Zlib
2020-04-01 07:44 445NodeJS12 and Zlib It works as ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 303Traefik 2020(1)Introduction and ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 390Private Registry 2020(1)No auth ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 351Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 435NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 382Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 309Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 221GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 409GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 287GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 283Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 279Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 263Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 252Serverless with NodeJS and Tenc ... -
NodeJS MySQL Library and npmjs
2020-02-07 06:21 250NodeJS MySQL Library and npmjs ... -
Python Library 2019(1)requests and aiohttp
2019-12-18 01:12 238Python Library 2019(1)requests ... -
NodeJS Installation 2019
2019-10-20 02:57 535NodeJS Installation 2019 Insta ... -
Monitor Tool 2019(2)Monit on Multiple Instances and Email Alerts
2019-10-18 10:57 238Monitor Tool 2019(2)Monit on Mu ... -
Sqlite Database 2019(1)Sqlite3 Installation and Docker phpsqliteadmin
2019-09-05 11:24 334Sqlite Database 2019(1)Sqlite3 ... -
Supervisor 2019(2)Ubuntu and Multiple Services
2019-08-19 10:53 333Supervisor 2019(2)Ubuntu and Mu ...
相关推荐
rlang, 面向 R 编程的低层 API rlang 重要的: rlang API仍在成熟。 请参见 ?rlang::lifecycle 以获得被认为是稳定的函数列表。概述rlang软件包提供了使用 R 和tidyverse的核心语言功能的工具:系统
rlang; Python; rpy2 2017-12-21 rlang; 电阻 2018-02-16 新维; linux 2018-02-03 jupyter; 工作室; 笔记本; 系统 2018-03-08 护目镜; 乌本图 2018-03-19 Python; R; 包裹; 备份; 恢复; 点子; conda 2018-03-19...
R语言迷你教程 编程是一点点学习的。 您建立在基本概念上。 您将已经拥有的知识转移到另一种语言。 午餐休息课程在短期课程中讲授R(一种用于数据分析和报告的最受欢迎的编程语言),以扩展现有程序员已经知道的知识...
都是我在画图中需要用到的包,如...2.3.0/maps_3.3.0/maptools_0.9-4/memoise_1.1.0/munsell_0.5.0/pillar_1.3.0/plyr_1.8.4/R6_2.2.2/RCurl_1.95-4.11/rlang_0.3.0.1/scales_1.0.0/sp_1.3-1/tibble_1.4.2/withr_2.1.2
rlang:使用R进行编程的低级API
由于R软件版本问题,一些函数不能运用,在此编写了一个程序包可以使那些函数可以用。
DATA 606 2021年Spring 课程网站 该课程网站是使用创建的,该扩展了框架,该框架使用RMarkdown文件生成了静态网站。 具体来说,Blogdown将首先将Rmd文件转换为md文件,然后再由Hugo将其转换为HTML。 默认情况下,此...
三层DLL架构解决方案-示范,值得研究一下
R是用于数据分析的语言,通过Rcpp可以将cpp库引入R中使用,适用于提高性能和接入原有算法库的场合。 Rcpp包提供C++类方便C or C++代码与R软件包进行交互,使用R中提供的.Call() 调用界面。 Rcpp提供R中的基础数据...
uga/RiTMIC.gitcd RiTMIC R构建包install.packages( " devtools " )# mixtools htmltools scales yaml lazyeval plyr rlang ggplot2 gtools caTools KernSmooth penda progressdevtools :: load_all(); devtools :: ...
商标 该RiTMIC [R包进行虚拟从RNA测序的RNA测序数据模拟,数据组学的个性化差异分析随着penda...devtools :: load_all(); devtools :: document(); devtools :: install() 建立小插图 setwd("vignettes") rmarkdown::r
京东商城API接口,支持多种语言版(Java,C#,Python,Delphi,RLang,GoLang等语言)接口方式,可以通过配置界面直接配置,非常简单,非常直观,1小时可以上手
Erlang opt_win64 20.2 windows exe 安装包 Erlang 20.2 is the upcoming version of Erlang For Windows x64 installer 截至2018.01.25 groovy最新最稳定版本
A GUIDE TO FUNCTIONAL PROGRAMMING IN E RLANG FOR THE EXPERIENCED PROCEDURAL DEVELOPER.
数据分析和可视化的蘸酱 包装dipsaus提供add-ons到各种软件包,如shiny , rlang , future等,以增强这些软件包。 从Github安装开发版本包, devtools :: install_github( ' dipterix/dipsaus ' ) dipsaus从以下...
pip安装gunicorn时出现这个错: Collecting gunicorn (from -r requirements.txt (line 9)) Downloading ... |████████████████████████████████| 81kB 5.3MB/s ERROR: Pac
ECG是E rlang函数C的所有图G enerator,其自动绘制函数调用和处理程序派生。 ECG利用Erlang强大的跟踪机制和可视化工具graphviz ,确保已安装graphviz ,并且由于此处使用Python绑定,因此还需要安装Digraph软件包。...
backbone cordova drools els erlang idea ip jenkins less meteor mis nginx perl php7 postgresql qc rlang sass scrapy selenium shell smarty solr vuw webgl wxpy zookeeper 计算机基础 软工 数据结构 数据挖掘