title: Plot multiple columns in r with barplot
body: <p>How do I plot a bar graph using data from 3 columns in a dataframe read from a csv file? I tried doing it with the following code but had some difficulty getting my desired output:</p>
  
  <pre><code>setwd("\\path\\to\\csv")
  df = read.csv("xxxx.csv")
  
  # All hospitals in AL
  AL = df[grep("AL", df$State),]
  
  hos &lt;-subset(AL,Hospital.Name=='COOPER GREEN MERCY HOSPITAL')
  
  
  # Gives me "Error in -0.01 * height : non-numeric argument to binary operator"
  
  hos &lt;- data.frame (HeartAttack=hos$Heart.Attack.Mortality,HeartFailure=hos$Heart.Failure..Mortality,
                     Pneumonia=hos$Pneumonia.Mortality)
  
  # Gives me the graph without displaying the x-axis values 
  # but completely defeats the purpose of reading from a csv file since the values are hard-written
  
  #hos &lt;- data.frame (HeartAttack=c(1),HeartFailure=c(5),Pneumonia=c(10))
  
  barplot(t(as.matrix(hos)),main='Mortality Rate in Cooper Green Mercy Hospital',
          xlab='Illness',ylab='Mortality Rate',beside=TRUE)
  </code></pre>
  
  <p>The csv file has 10 headers (from left to right): Hospital.Name, City, State, County.Name, <strong>Heart.Attack.Mortality</strong>, Heart.Attack.Readmission, <strong>Heart.Failure..Mortality</strong>, Heart.Failure.Readmission, <strong>Pneumonia.Mortality</strong> and Pneumonia.Readmission. Bold ones are the columns I'm interested in.</p>
  
  <p><img src="https://i.stack.imgur.com/sVsMB.png" alt="Desired output"></p>
  
  <p>Note: I have already looked at these <a href="https://stackoverflow.com/questions/16617365/create-barplot-from-data-frame">two</a> <a href="https://stackoverflow.com/questions/37931327/barplot-with-multiple-columns-in-r">SO questions</a>, but they did not quite solve my problem.</p>