I would like to add a new row to a data frame; however, this row in my case has more values. Let's assume I have the following dataset:
> df <- data.frame(0,0,0)
> colnames(df) <- c("A","B","C")
> df
A B C
0 0 0
Now let us have a vector with 4 elements.
> x <- c(0,0,0,0)
> names(x) <- c("A","B","D","C")
> x
A B D C
0 0 0 0
I would like to add this vector to the data frame above such that
> df
A B C D
0 0 0 NA
0 0 0 0
Is there a way to do this?