R工具:连接数据库,查数据,画时间序列图,加点、文本
2012-11-12 16:17
525 查看
1.channel=odbcConnect('XXXX')
2.dd=sqlQuery(channel,"select distinct CONVERT(datetime,left(scaler,10))as date,max(amount_persecond) as cles from dm.y20120630_all where node=316 group by scaler")
3.p=qplot(date, cles, data = dd, geom = c("line","smooth"),method="lm",formula=y~ns(x,8))
4.highest <- subset(dd, cles == max(cles))
5.ss=paste("峰值:",highest[2]$cles,"\n时间:",highest[1]$date,collapse="\n")
6.p+geom_point(aes(x=highest[1]$date,y=highest[2]$cles),colour="red",size=5)+geom_text(aes(highest[1]$date, highest[2]$cles, label = paste("****",ss)),hjust = 1, vjust = 1, size = 4)
2.dd=sqlQuery(channel,"select distinct CONVERT(datetime,left(scaler,10))as date,max(amount_persecond) as cles from dm.y20120630_all where node=316 group by scaler")
3.p=qplot(date, cles, data = dd, geom = c("line","smooth"),method="lm",formula=y~ns(x,8))
4.highest <- subset(dd, cles == max(cles))
5.ss=paste("峰值:",highest[2]$cles,"\n时间:",highest[1]$date,collapse="\n")
6.p+geom_point(aes(x=highest[1]$date,y=highest[2]$cles),colour="red",size=5)+geom_text(aes(highest[1]$date, highest[2]$cles, label = paste("****",ss)),hjust = 1, vjust = 1, size = 4)
相关文章推荐
- 数据库连接函数并读取TXT文本中的数据
- c#连接sqlserver数据库、插入数据、从数据库获取时间示例
- python pd.crosstab在处理时间序列文本数据的用处
- Twitter开源云环境时间序列数据断层检测工具BreakoutDetection
- 时间序列数据库——索引用ES、聚合分析时加载数据用什么?docvalues的列存储貌似更优优势一些
- python pd.crosstab在处理时间序列文本数据的用处
- pands 时间序列 之日期和时间数据类型及工具
- ORACLE 快速批量导入文本数据到数据库(sqlldr工具)方法与分析
- 2015-04-09-时间序列(1)-日期和时间数据类型及工具+时间序列基础+日期的范围、频率以及移动
- 【原创】分布式大数据时间序列数据库设计概述
- 时间序列数据库——索引用ES、聚合分析时加载数据用什么?docvalues的列存储貌似更优优势一些。那分布式计算呢?ES做
- oracle 数据库的管理工具 PL/SQL_Developer 的简易使用 与Java 连接并查询显示出数据
- 3.JDBC XmlConfigReader类,读取连接数据库配置数据,把读取的数据封装在类JdbcConfig中
- 数据库左连接查询(查询多张表中的数据)
- 用ggplot2为时间序列数据绘图
- ASP.NET 连接数据库 添加数据
- Linq 数据合并,比较,连接,交叉 维恩图工具
- 用R分析时间序列(time series)数据
- java JDBC 连接数据库查询数据与直接使用sql的疑问
- 小象数据分析和数据挖掘(豆瓣数据案例,时间序列分析和金融数据,金融数据分析案例)