R shiny: Storing reactive data as a dataframe with factor values for predictive model

#1
i made a random forest predictive model and want my users to input the independent variables and predict the dependent variable. i'm using shiny to implement this.

i am getting the following error as the reactive values are stored as character inputs where as my predictive model is built with factor variables.

Warning: Error in predict.randomForest: Type of predictors in new data do not match that of the training data.

can any one help me how to convert this to a data frame with factor variables similar to my training data set. i used the following code.

Code:
#ui.R

library(shiny)
library(shinydashboard)
library(randomForest)


ui =   dashboardPage(

dashboardHeader(title = "title"),
dashboardSidebar(

  selectInput("transaction_type", "select transaction type:", choices = 
                tranlist),
  selectInput("entry_type", "select entry type", choices = entrylist),
  selectInput("sic", "select sic", choices = siclist),
  selectInput("markettype", "select market type", choices = marketlist),
  numericInput("qty", "enter quantity","",min = 0),
  numericInput("volume", "enter Total_amnt","",min = 0),
  actionButton("goButton","Enter")

),
dashboardBody(
  tableOutput("result"),

  textOutput("predict")
 )
)

#server.R

function(input, output,session){

pos <- eventReactive(input$goButton,{

if(input$goButton >0){


test[1:7] = c(input$transaction_type, input$entry_type, input$qty, input$volume , input$sic, input$markettype, input$volume/input$qty)
}  else{pos <- test}


test

})

output$result <- renderTable(pos())

output$predict = renderPrint(predict(settforest,newdata = pos(), type = "class"))

}