找数据总是一件很烦的事情,这个文档致力于收好用的常用的数据集合。
library(datasets)
data(swiss)
# swiss 数据集合是个不错的好用的数据集合
data(package = "package name")
。# The following dataset is from Hastie, Tibshirani and Friedman (2009), from a study
# by Stamey et al. (1989) of prostate cancer, measuring the correlation between the level
# of a prostate-specific antigen and some covariates. The covariates are
#
# * lcavol : log-cancer volume
# * lweight : log-prostate weight
# * age : age of patient
# * lbhp : log-amount of benign hyperplasia
# * svi : seminal vesicle invasion
# * lcp : log-capsular penetration
# * gleason : Gleason Score, check http://en.wikipedia.org/wiki/Gleason_Grading_System
# * pgg45 : percent of Gleason scores 4 or 5
#
# And lpsa is the response variable, log-psa.
url <- "http://statweb.stanford.edu/~tibs/ElemStatLearn/datasets/prostate.data"
str(pcancer <- read.table(url, header=TRUE))
## 'data.frame': 97 obs. of 10 variables:
## $ lcavol : num -0.58 -0.994 -0.511 -1.204 0.751 ...
## $ lweight: num 2.77 3.32 2.69 3.28 3.43 ...
## $ age : int 50 58 74 58 62 50 64 58 47 63 ...
## $ lbph : num -1.39 -1.39 -1.39 -1.39 -1.39 ...
## $ svi : int 0 0 0 0 0 0 0 0 0 0 ...
## $ lcp : num -1.39 -1.39 -1.39 -1.39 -1.39 ...
## $ gleason: int 6 6 7 6 6 6 6 6 6 6 ...
## $ pgg45 : int 0 0 20 0 0 0 0 0 0 0 ...
## $ lpsa : num -0.431 -0.163 -0.163 -0.163 0.372 ...
## $ train : logi TRUE TRUE TRUE TRUE TRUE TRUE ...
library(lqmm)
data(labor)
数据的查找基本功力有了,可以开始干活了!!!