advertising | R Documentation |
The advertising data set consists of sales of that product in 200 different markets. It also includes advertising budgets for the product in each of those markets for three different media: TV, radio, and newspapers.
data(advertising)
A data frame with 200 rows and 4 variables:
a numeric vector indicating the advertising budget on TV.
a numeric vector indicating the advertising budget on radio.
a numeric vector indicating the advertising budget on newspaper.
a numeric vector indicating the sales of the interest product.
https://www.statlearning.com/s/Advertising.csv
James G., Witten D., Hastie T., Tibshirani R. (2013, page 15) An Introduction to Statistical Learning with Applications in R, Springer, New York.
data(advertising)
breaks <- with(advertising,quantile(radio,probs=c(0:3)/3))
labels <- c("low","mid","high")
advertising2 <- within(advertising,radioC <- cut(radio,breaks,labels,include.lowest=TRUE))
dev.new()
with(advertising2,plot(TV,sales,pch=16,col=as.numeric(radioC)))
legend("topleft",legend=c("low","mid","high"),fill=c(1:3),title="Radio",bty="n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.