Counting equal elements in a data.frame and plotting
質問
I am using RMySQL to retrieve a table from the server. The result has columns
id
CountryCode
date
Value
CountryCode
can repeat itself n times.
What I would like to do is to get the total count of all CountryCode
s and then plot the result.
I am new to R so I am not sure if this is done with a for
or there is a simpler way to go through the data.frame to get this information.
I appreciate any tip in the right direction Thanks!
解決
Assuming these are in a dataframe named "dfrm":
ctbl <- table(dfrm$CountryCode)
plot(ctble)
所属していません StackOverflow