Heres my data:
> data
Manufacturers Models
1 Audi RS5
2 BMW M3
3 Cadillac CTS-V
4 Lexus ISF
I would like to add 1 row in the fourth row, like this:
> data
Manufacturers Models
1 Audi RS5
2 BMW M3
3 Cadillac CTS-V
4 Benz C63
5 Lexus ISF
I have tried to use the rbind() like this:
Benz = data.frame(Manufacturers = "Benz", Models = "C63")
newdata = rbind(data,Benz)
But I cannot add to the place I want. I would appreciate any help on this question. Thanks a lot.
this function would improve and solve your problem:
Thanks for read me!
In case you don't want the index but rather a one-off "quick fix" for some spreadsheet-like appearance, you might resort to
If order is an important feature of your dataset then you should codify it in a safe way, e.g., by using an index variable. I wouldn't rely on rownames or the order of the data.frame rows since there are operations where they are not preserved.
I used the @Sergio Mora answer to adapt and solve the question. I saw today the question and I needed a solution.