เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Visually Inspecting the Data

You are given historical revenue (hist_rev) and projected revenue (proj_rev) data for a company. Create a bar chart of data, which includes coloring the historical and projected revenues differently, as well as adding a chart title and legend. The revenue data is in the object rev, which is stored in memory.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Equity Valuation in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Create a bar chart, color historical data red and projected data blue, and add the title "Historical vs. Projected Revenues".
  • Create a legend with data labels "Historical" and "Projected" with colors matching the bars.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Create a bar chart
barplot(rev,
    col = c(___, ___),
    main = ___)

# Add legend
legend("topleft",
       legend = c(___, ___),
       fill = c(___, ___))
แก้ไขและรันโค้ด