1
df <- read.csv('train.csv')
train1 <- train[train$variavel3 == 1]
train2 <- train[train$variavel3 == 0]
fit1 <- rpart(variavel1~variavel2)
fit2 <- rpart(variavel1~variavel2)
dftest <- read.csv('test.csv')
dftest1 <- test[test$variavel3 == 1]
dftest2 <- test[test$variavel3 == 0]
prediction1 <- predict(fit1, dftest1)
prediction2 <- predict(fit2, dftest2)
dataframe1-----------dataframe2
x1---x2-----------------x1------x2
1----0-------------------2-------0
3----0-------------------4-------1
6----1-------------------5-------1
I want to join the dataframes so that X1 is in the correct order
Hello Pedro, welcome to Stack Overflow. Could you edit your question and specify what you mean by "join"? It would just create a dataframe with the data from
prediction1
followed by data fromprediction2
?– Anthony Accioly
It would not be just join, as for example use rbind, because it has to be in the order of a variable. I just discovered the function merge. I’ll test you now
– Pedro Teixeira
The idea of merge was good but did not work, saying "no data available in table"
– Pedro Teixeira
You may be looking for this: http://answall.com/q/124319/6036
– Daniel Falbel
I improved my question
– Pedro Teixeira