title: How to seamlessly plot F1, prec, recall from file in R
body: <p>I have a small csv tab delimited file with the following data:</p>
  
  <pre><code>alg f1  prec    recall
  rf  0.85891 0.808976    0.915413
  svm 0.927857    0.988347    0.874345
  knn 0.653483    0.611013    0.702298
  nb  0.372421    0.253795    0.699256
  </code></pre>
  
  <p>I want to plot it like this: </p>
  
  <p><a href="https://i.stack.imgur.com/Os7WJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Os7WJ.png" alt="enter image description here"></a></p>
  
  <p>I am complete newbie in R so I load my data the following way:</p>
  
  <pre><code>library(ggplot2)
  library(plotly)
  
  # performance of various algs
  test &lt;- data.frame(header &lt;- c("F-1", "Precision", "Recall"),
                     alg1 &lt;- c(0.66381,   0.523659,   0.906397),
                     alg2 &lt;- c(0.909586,  0.951798,   0.87096),
                     alg3 &lt;- c(0.402166,  0.282086,   0.700253),
                     alg4 &lt;- c(0.141439,  0.078692,   0.698064)
                    )
  
  # plotting
  ppl &lt;- function() {
    ggplot(test, aes(header, colour = "alg", group = 4)) + 
      geom_line(aes(y = alg1, colour = "rf"), size=1) +
      geom_line(aes(y = alg2, colour = "svm"), size=1) +
      geom_line(aes(y = alg3, colour = "knn"), size=1) +
      geom_line(aes(y = alg4, colour = "nb"), size=1) +
      xlab("measures") +
      ylab("score") +
      labs(title = "") +
      theme(legend.justification = c(1, 1), legend.position = c(1, 1))
  }
  
  ppl()
  </code></pre>
  
  <p>So, for each plot line I manually insert the numbers while I know that I can do</p>
  
  <pre><code>data = read.table(file=file.choose(), sep="\t", header = TRUE)
  </code></pre>
  
  <p>And then somehow arrange the data so that <code>ggplot</code> wouldn't complain about "Aesthetics" unfortunately I don't know how. Is there are a better and less tedious way to plot the following file table?</p>