[R] What is the easiest way to turn a dataframe into a barplot?

John Dougherty jwd at surewest.net
Fri May 13 05:47:32 CEST 2016


On Thu, 12 May 2016 13:19:54 -0400
"yoursurrogategod at gmail.com" <yoursurrogategod at gmail.com> wrote:

> Hello, I can't post my code since it's on a work computer.
> 
> But basically, I have a dataframe that has two columns, one is a
> string and the other is an integer.  I want to turn this into a
> vertival barplot where on the x-axis I have the string in the first
> columb and then the plot will display the integer count.
> 
> I have found many examples online and most of those matched either
> odd edge cases or putting the data into a format that strips out some
> of the data and I can't use it later.
> 
> This should be a breeze, what am I missing?

Without showing a data sample, no one can really do more than guess
what you are asking.  Among other things, no one "turns" a
dataframe "into" a barplot, ever.  It would defeat the purpose of
collecting the data to begin with.  It is also unclear what data the
process could strip out, or why you can't use the data again, unless
you are attempting to overwrite the dataframe with the bar plot.  

A barplot is a visual summary of data. So, best to bite the bullet and
supply an example. That way we can understand what you are attempting to
summarize.  As long as it has a similar structure and data types, you
can make it up. You would also benefit a great deal from reading up on
R and communicating in a manner that the community can follow. Sadly, no
specialized community exists without its own specialized jargon and
R-help is an intersection of at least two such communities.

JWDougherty



More information about the R-help mailing list