#==============
read.csv("")
applesam<-read.csv
("applesamsung20150628.csv")
str(applesam)
# converting date types
http://www.statmethods.net/input/dates.h
tml
names(applesam)[1] <- "datetimeStr"
applesam$dateD <- as.Date(substr
(applesam$datetimeStr,1,10))
head(applesam,3)
ncomp <- nrow(applesam)-1
tmp<- applesam$dateD[2:nrow(applesam)]-applesam$dateD[1:ncomp]
$dateD[1:ncomp]
applesam$apple<-as.numeric(applesam
$apple)
applesam$samsung<-as.numeric(applesam
$samsung)
length(applesam$apple) ; length
(applesam$samsung)
plot(applesam$apple,applesam$samsung)
require(sqldf)
applesam_d <- sqldf("select dateD, avg
(apple) as avg_app,
avg(samsung) as avg_sams,
count(*) as cnt
from applesam
group by dateD" )
str(applesam_d)
head(applesam_d,2) ; tail(applesam_d,2)
plot(applesam_d$avg_app,applesam_d
$avg_sams)
tmp1 <- applesam_d[order(applesam_d
$dateD),]
yrange<-range(applesam_d$avg_app,
applesam_d$avg_sams )
yrange <- c(0,100)
plot(applesam_d$avg_app,ylim=yrange,
type="b", col=2)
lines(applesam_d$avg_sams,type="b",
col=3)
# lines(applesam_d$avg_sams*0,type="b",
col=4)
# lines(100-(applesam_d
$avg_sams*0),type="b", col=5)
#--------- plotting details ------
yrange <- c(0,100)
plot(applesam$apple,ylim=yrange,
type="b", col=2)
lines(applesam$samsung,type="b", col=3)
'R 데이터 분석' 카테고리의 다른 글
경기도 버스 : 경기도교통정보센터 (0) | 2015.06.29 |
---|---|
GT apple samsung applications (0) | 2015.06.29 |
R 서울시 CCTV 구별설치대수 통합 예제 (0) | 2015.06.26 |
# MERGE 연습 (0) | 2015.06.26 |
R 데이터 처리 연습 _ Crashes (0) | 2015.06.26 |