Skip to content

Commit

Permalink
4章のRスクリプトのデータフレームの列名がわかりにくい部分を修正。
Browse files Browse the repository at this point in the history
  • Loading branch information
setoyama60jp committed Jan 12, 2013
1 parent 6b2c70e commit 8d5f6a0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Chapter4/example4-8.r
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ data <- read.table("simulation2.csv", header = TRUE, sep = ",")
mean <- mean(data)
median <- apply(data, 2, median)
max <- apply(data, 2, max)
df <- data.frame(population = seq(from = 1, to = 30), mean = mean, median = median, max = max)
df <- data.frame(facilities = seq(from = 1, to = 30), mean = mean, median = median, max = max)

ggplot(data = df) + scale_shape_manual(name = "Type", values=c(2,3,4)) +
geom_smooth(aes(x = population, y = mean)) +
geom_point(aes(x = population, y = mean, shape = "mean")) +
geom_smooth(aes(x = population, y = median)) +
geom_point(aes(x = population, y = median, shape = "median")) +
geom_smooth(aes(x = population, y = max)) +
geom_point(aes(x = population, y = max, shape = "max")) +
ggplot(data = df) + scale_shape_manual(name = "Type", values=c(2,3,4)) +
geom_smooth(aes(x = facilities, y = mean)) +
geom_point(aes(x = facilities, y = mean, shape = "mean")) +
geom_smooth(aes(x = facilities, y = median)) +
geom_point(aes(x = facilities, y = median, shape = "median")) +
geom_smooth(aes(x = facilities, y = max)) +
geom_point(aes(x = facilities, y = max, shape = "max")) +
scale_y_continuous("queue size") +
scale_x_continuous("number of facilities in a restroom")

Expand Down

0 comments on commit 8d5f6a0

Please sign in to comment.