How to delete any row from a data frame in R? [duplicate]

1

I have a date frame as follows:

How do I remove the first line?

    
asked by anonymous 15.07.2016 / 00:24

1 answer

4

To exclude a line from data.frame you should not select that line and overwrite your data.frame .

For example, using data from% cos of your image:

notas.inform <- data.frame(nros = c(2355, 3456, 2334, 5456),
                           turma = c("tp1", "tp1", "tp2", "tp3"),
                           notas = c(10.3, 9.3, 14.2, 15.0))

If you want to delete the first line of data.frame , simply select all lines except the first line and overwrite notas.inform :

notas.inform <- notas.inform[-1, ] # deleta a primeira linha
notas.inform
  nros turma notas
2 3456   tp1   9.3
3 2334   tp2  14.2
4 5456   tp3  15.0
    
15.07.2016 / 03:49