I have the following dataframes tt1
> tt1[2,]
date close emp pred
2 1982-03-24 112.97 -1 1
and dataframe tt2
> tt2[2,]
date close emp pred
2 1982-03-25 113.21 1 1
when I try to use rbind()
I get weird row name for the 2nd row.
> rbind(tt1[2,],tt2[2,])
date close emp pred
2 1982-03-24 112.97 -1 1
21 1982-03-25 113.21 1 1
any clue has to how to get rid of that have it as 1, 2
The function rbind() is slow, particularly as the data frame gets bigger. You should never use it in a loop. The right way to do it is to initialize the output object at its final size right from the start and then simply fill it in with each turn of the loop.
Note that this does not remove duplicate rows across the two DataFrames. Returns a new DataFrame containing rows of all parameters.
The default (is back compatible), FALSE , will signal an error, where NA will “automatic” row names and TRUE will call make. names(value, unique=TRUE) for constructing valid names.
Try
rownames(mydataframe) <- NULL
See the documentation (type ?rownames
on the prompt) for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With