私はあなたがベースRとggplot2で提供したものでできる限り最高のものを作り出そうとします。
library(ggplot2)
celeb <- c("Kim Kardashian", "The chubby kid from stand by me", "The bassist from the local Clash cover band", "One of L. Ron Hubbard's polyps", "Frank Zappa", "Dweezil Zappa", "Moonunit Zappa", "Scott Evil")
death <- c("Gored by rhino", "Eaten by Compies", "Choked on funyun", "Gored by rhino", "Gored by rhino", "Eaten by Compies", "Gored by rhino", "Failed to meet dad's expectations")
df <- cbind(celeb, death)
df <- as.data.frame(df)
私の感覚は、あなたが死の原因をランク付けして、それから何かをプロットしたいということです。これはあまりにも複雑ですが、私はあなたにそれを行うための一歩一歩を示すだけであると考えました。
#first get counts of deaths
deathcounts <- as.data.frame(table(df$death))
#next put them in decreasing order
topfour <- deathcounts[order(deathcounts$Freq, decreasing=T)[1:4],]
#cool, so rhinos are dangerous mofos. Let's plot these results
deathplot <- ggplot(topfour, aes(x=Var1, y=Freq)) + geom_bar(stat="identity")
あなたのフリルは、プレーンな結果は次のとおりです。 
出典
2017-12-27 22:21:17
Lee
まずあなたがRのデータフレームにCSVデータをインポートする必要があります。 [Rタグwiki](https://stackoverflow.com/tags/r/info)には初心者の資質がたくさんありますが、* R *入門から始めることをお勧めしますが、ここで多くの質問を見つけることもできます"[r] csv'を検索するとスタックオーバーフローが発生する – Gregor
[良い質問をする方法](http://stackoverflow.com/help/how-to-ask)に関する情報をお読みください。 [再現可能な例](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610)。これは他の人があなたを助けることをはるかに容易にします。 – Jaap
私は特定の年齢で何人の有名人が死亡したかなど、他のグラフを作成しました。しかし、私はその死のトップ10の原因をどうやって作るのか分かりません。 – Mateusz