因子摘要
就像一位專業的債券投資人一樣,你想追蹤自己持有的各信用評等債券各有多少張。若能用一個表格呈現各信用評等等級的持有數量,那就太好了!幸運的是,因子可用的 summary() 函式正好能幫上忙。
字元向量 credit_rating 和因子 credit_factor 都已在你的工作空間中。
本練習屬於課程
R for Finance 入門
練習說明
- 先對
credit_rating呼叫一次summary()。這看起來實用嗎? - 再次嘗試
summary(),但這次用在credit_factor上。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Summarize the character vector, credit_rating
# Summarize the factor, credit_factor