【发布时间】:2017-07-08 16:31:05
【问题描述】:
我想为列中的每个变量绘制一个直方图(单独)。数据是使用 CSV 文件 (sample.csv) 导入的,看起来像
ip_addr_player_id, event_name, level, points_earned, stars_earned, moves
118.93.180.241, Puzzle Complete, Botany Lab Puzzle 1, 1000, 2, 2
118.93.180.241, Puzzle Complete, Botany Lab Puzzle 2, 1000, 2, 2
118.93.180.241, Puzzle Complete, Botany Lab Puzzle 3, 1000, 2, 2
203.166.252.219, Puzzle Complete, Botany Lab Puzzle 1, 1000, 2, 2
54.166.252.324, Puzzle Complete, Botany Lab Puzzle 5, 1000, 2, 2
鉴于每个ip_addr_player_id 都是唯一的,我想为points_earned、starts_earned 和moves 绘制直方图(对于每个ip_addr_payer_id)。
我根据一个可以在网上找到的示例进行了尝试;
library(readr)
dataIn <- read.csv("sample.csv")
#View(dataIn)
library(ggplot2)
plot <- ggplot(dataIn, aes(level, points_earned, fill=points_earned))+
geom_histogram() + facet_wrap(~ip_addr_player_id)
plot
但是这段代码没有给我任何输出。
【问题讨论】:
-
供您参考,您可以阅读how to make a reproducible example in r 以在您的问题中提供一个最小数据集,以便为其他用户回答您的问题。请注意,这不是您问题的答案,而是告诉您如何提问的链接。