全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
24344 16
2012-01-17
悬赏 20 个论坛币 已解决
我知道在ggplot2程序包中有diamonds这个数据集,我也安装了ggplot2这个程序包,并且,我使用 data(package = .packages(all.available = TRUE))这个命令也成功地显示:
Data sets in package ‘ggplot2’:
diamonds               Prices of 50,000 round cut diamonds
economics              US economic time series
midwest                Demographic information of midwest counties
movies                 Movie information and user ratings from
可是,是该如何查看或者调用diamonds这个数据集呢?
我曾尝试在R提示符下直接输入diamonds,但提示:“错误: 找不到对象'diamonds'


最佳答案

mathfan 查看完整内容

I think the following codes works: library(ggplot2) data(diamonds) summary(diamonds)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-1-17 00:50:50
I think the following codes works:

library(ggplot2)
data(diamonds)
summary(diamonds)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-17 01:10:19
To see the first 5 rows of the data:

diamonds[1:5,]
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-17 01:29:47
我的没有问题,是不是你的ggplot2没装好


> library(ggplot2)
Loading required package: reshape
Loading required package: plyr

Attaching package: ‘reshape’

The following object(s) are masked from ‘package:plyr’:

    rename, round_any

Loading required package: grid
Loading required package: proto
> head(diamonds)
  carat       cut color clarity depth table price    x    y    z
1  0.23     Ideal     E     SI2  61.5    55   326 3.95 3.98 2.43
2  0.21   Premium     E     SI1  59.8    61   326 3.89 3.84 2.31
3  0.23      Good     E     VS1  56.9    65   327 4.05 4.07 2.31
4  0.29   Premium     I     VS2  62.4    58   334 4.20 4.23 2.63
5  0.31      Good     J     SI2  63.3    58   335 4.34 4.35 2.75
6  0.24 Very Good     J    VVS2  62.8    57   336 3.94 3.96 2.48
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-17 01:41:05
Hi~
data("diamonds",package="ggplot2")  
may also works~
hope that will help you~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-17 07:33:19
library(ggplot2)
data(diamonds)
diamonds
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群