繪製選擇占比圖
讓我們用剛產生的選擇占比來收尾本章。這些占比已經存成資料框 shares 中名為 share 的欄位。你可以用 barplot() 繪製 shares$share。如果你不熟悉 barplot(),可以輸入 ?barplot 查看說明文件。
本練習屬於課程
R 的行銷選擇模型
練習說明
將 barplot 函式的第一個輸入設為 shares$share。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Use barplot to plot predicted market shares
barplot(___, ylab="Predicted Market Share",
names.arg=c("Our Car", "Comp 1", "Comp 2", "Comp 3"))