1
To delete a line from data.frame
you must not select that line and overwrite your data.frame
.
For example, using data from data.frame
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 from notas.inform
, just select all lines except the first 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
I don’t quite understand Ben, the first line of what? if possible put the code not an image.
– Guilherme Lima
Fernando, welcome to Sopt, visit Ajuda and take the Tour. Although the question seems clear, I believe you can improve it by clarifying further your difficulties or attempts (more details), so those who can help you will have more content for it. Edit your question for both.
– Leo