2017-10-15 19:58:13
一种
Spark, …)
Fig. Analytics tools used by respondents to the 2015 Rexer Analytics Survey (multiple choice). - r4stats

Fig. Lavastorm survey of analytics tools. - r4stats
help(), ??ggplot2::aes或手动导航
browseVignettes("ggplot2")

RStudio 1.0 GUI
(Tools -> Global Options)
(Control PanelControl Panel Items-> Change settings -> Advanced -> Environment variables)
Sys.getenv('PATH'))gcc, mingw等编译工具install.packages(c("<包名1>", "<包名2>", ...))RODBC, RMySQL, RPostgresSQLreadr, XLConnect, readxlXML, httr, jsonlite, RCurldplyr, tidyr, reshape2stringr, lubridate, timeDatecar, lme4, glmnet, survivalquantmod, xts, zoosp, maps, maptools, ggmapcaret, e1071, kernlabNLP, tm, RTextToolsggplot2, rCharts, ggvis, htmlwidgets族(leaflet, DT, dygraphs, DiagrammR, d3heatmap, …), plotly, rgl, rbokeh, highcharterrmarkdown, knitr, shiny, ReporteRsdata.table, Rcpp, paralleldevtools, roxygen2, testthat通过Rcmdr或rattle包调用tcltk库,驱动图形界面,进行整理、分析、挖掘
library(Rcmdr) ## 加载Rcmdr包 Commander() ## Rcmdr主函数

library(rattle) ## 加载rattle包 rattle() ## rattle主函数

| 优点 | 缺点 | |
|---|---|---|
| 1 | 直观 | 结果杂乱 |
| 2 | 便捷 | 无法复用 |
1:4 + 1:4
## [1] 2 4 6 8
library(plotly) plot_ly(cars, x=~speed, y=~dist) %>% add_markers()
scatter cars
source该.R脚本读入,编辑或块选执行R CMD或Rscript命令调用脚本| 优点 | 缺点 | |
|---|---|---|
| 1 | 可复用 | 需脚本管理 |
| 2 | 代码逻辑 | 结果欠结构 |
保存一个intro.R脚本
# Open pdf device and name it
pdf('intro.pdf')
# Lazy plot a scatterplot
plot(cars, main='Scatterplot of cars')
# Close all the devices
dev.off()
执行intro.bat,内容为
@echo off : If Rscript is not in PATH, define the location manually Rscript.exe intro.R @pause
最后在脚本同目录下生成一个intro.pdf。全过程不出现RGui。
| 优点 | 缺点 | |
|---|---|---|
| 1 | 可反复运行 | 有一定学习成本 |
| 2 | 文学化编程 | 需要一定的构思 |
rmarkdown::render()生成文档rticles包)基于template的文档public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
<!DOCTYPE html>
<body>
<?php
echo "Hello, world!";
?>
</body>
</html>var sys = require("sys");
sys.puts("Hello, world!");
print("Hello, world!")
println("Hello, world!")
print("Hello, world!")
Thank you!