R对数据做相关性,周期性分析——搭建数据分析平台

连接数据库


R中没有的包用  install.packages("packageName")下载

library(Rserve);
Rserve();
library(RODBC);
channel <-odbcConnect("mydata",uid = "root",pwd="1299894209+");
sqlTables(channel);
data<-sqlFetch(channel,"airinfo")

org1<-sqlFetch(channel,'airinfo')
org2<-sqlQuery(channel,'select * from airinfo')
org3<-sqlQuery(channel,'select * from airinfo where id < 301')

head(org1)
head(org2)
odbcClose(channel)
画周期性图
library(zoo)
library(base)
Time<-org3$date
data.ts<-zoo(org3$CO2,Time)
plot(data.ts,xlab='date',ylab='CO2')

data2<-zoo(org3$temperature,Time)
plot(data2,xlab='date',ylab='temperature')

setwd("D:/environment/R/Rworksp")
png(file = "test1.jpg")
png('D:/environment/R/Rworksp',width=1200,height=500,units="px")
library(zoo)
library(base)



你可能感兴趣的:(校园环保数据分析平台)