Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
library(ggplot2)
library(scales)
# データの読み込み
data <- read.csv("/path/to/activities.csv", header=T)
# 基本統計量
summary(data$steps)
# グラフ(日ごとの推移)
graph <- ggplot(data, aes(x=as.Date(date), y=steps, fill=weekday)) + scale_fill_gradientn(colours=c('#ff4500', '#434348', '#434348', '#434348', '#434348', '#434348', '#87cefa')) + geom_bar(stat='identity') + scale_x_date(label = date_format("%m月%d日")) + theme_bw(base_family = "Osaka") + xlab("日時") + ylab("歩数") + ggtitle("歩数の時系列推移")
plot(graph)
# グラフ(曜日別)
graph <- ggplot(data, aes(x=as.character(weekday), y=steps)) + geom_boxplot() + theme_bw(base_family = "Osaka") + scale_x_discrete(labels=c('','','','','','','')) + xlab("曜日") + ylab("歩数")
plot(graph)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment