1
I have a date.frame and a value in R, I needed this value to be included in the last row of a certain column of this date.frame. I’ve tested the function rbind
but it didn’t work.
x <- c(1:15)
y <- c(1:15)
z <- 4
df <- data.frame(x,y)
df <- rbind(x, z)
The question is not well formulated. What is the expected answer to it, since
df
has two columns andz
has only one observation? The last line should be formed byc(4, 4)
? Orc(NA, 4)
? Or elsec(4, NA)
? Please check this and be more clear about your needs.– Marcus Nunes
Forgiveness, the value of Z should be included in the last line of X, therefore c(4, NA)
– Alexandre Sanches
But
x
has only one dimension. By chancec(4, NA)
should be the last line ofdf
?– Marcus Nunes
Yes, df should have 16 lines, and the last should be c(4, NA)
– Alexandre Sanches