Shiny error oon function

I have been strugling for hours to find out what's worng with my shiny app. The server and ui are below, as well as the function that makes the prediction for the server.

As I write in the text box the reactiveness does work, but the same error appears. I am not an expert in Shiny. This is my second app.

When I run it I get below app (image):enter image description here

Please help.

Function:

library(tidyr)
library(dplyr)
library(quanteda)
library(stringr)

## Read-in frequencies
df1 <- readRDS("./App/nextword/g1.rds")
df2 <- readRDS("./App/nextword/g2.rds")
df3 <- readRDS("./App/nextword/g3.rds")
df4 <- readRDS("./App/nextword/g4.rds")

texti <- "i, Don't think"
texti <- corpus(texti)
texti <- corpus(tolower(texti))
## Clean input
texti <- tokenize(texti,
               remove_numbers = TRUE,
               remove_punct = TRUE,
               remove_symbols = TRUE,
               remove_separators = TRUE,
               remove_twitter = TRUE,
               remove_hyphens = TRUE,
               remove_url = TRUE,
               concatenator = " ",
               verbose = FALSE)

texti <- dfm(texti)
texti <- data.frame(word = featnames(texti), row.names = NULL, stringsAsFactors = FALSE)

p <- function(texti) {

        if(texti[1, ] == "" & texti[2, ] == "" & texti[3, ] == "") {
                prediction = df1 %>%
                        select(word, Frequency)

        }   else if(texti[1, ] %in% df4$w1 & texti[2, ] %in% df4$w2 & texti[3, ] %in% df4$w2) {
                prediction = df4 %>%
                        filter(w1 %in% texti[1, ] & w2 %in% texti[2, ] & w3 %in% texti[3, ]) %>%
                        select(w4, Frequency)     

        }   else if(texti[1, ] %in% df3$w1 & texti[2, ] %in% df3$w2) {
                prediction = df3 %>%
                        filter(w1 %in% texti[1, ] & w2 %in% texti[2, ]) %>%
                        select(w3, Frequency)

        }   else if(texti[1, ] %in% df2$w1) {
                prediction = df2 %>%
                        filter(w1 %in% texti[1, ]) %>%
                        select(w2, Frequency)

        }   else{
                prediction = df1 %>%
                        select(word, Frequency)
        }

        return(prediction)
}

server:

library(shiny)
library(shinythemes)
library(markdown)

shinyServer(function(input, output, session) {

        pt1 <- reactive(p(input$texti)[1])
        output$texti1 <- pt1
        observeEvent(input$b1, { 
                updateTextInput(session, "texti",
                                value = paste(input$texti, pt1()))
        })
        pt2 <- reactive(p(input$texti)[2])
        output$texti2 <- pt2
        observeEvent(input$b2, { 
                updateTextInput(session, "texti",
                                value = paste(input$texti, pt2()))
        })
        pt3 <- reactive(p(input$texti)[3])
        output$texti3 <- pt3
        observeEvent(input$b3, { 
                updateTextInput(session, "texti",
                                value = paste(input$texti, pt3()))
        })
})

ui:

library(shinythemes)
shinyUI(fluidPage(
        theme = shinytheme("darkly"),
        tags$hr(),
        titlePanel("Next Word Prediction Application"),
        tags$hr(),

        mainPanel(tabsetPanel(
                tabPanel("Prediction",
                         sidebarLayout(
                                 sidebarPanel(
                                         width = 3,
                                         tags$p(""),
                                         tags$h5("Predicted next word:"),
                                         flowLayout(
                                                 actionButton("b1", label = textOutput("texti1")),
                                                 actionButton("b2", label = textOutput("texti2")),
                                                 actionButton("b3", label = textOutput("texti3"))
                                          )
                                 ),
                                 mainPanel(
                                         tags$p(""),
                                         tags$h5("Please, enter your text:"),
                                         h4(tags$textarea(id = "texti", rows = 1, cols = 30, "")))
                         )),
                tabPanel("About", includeMarkdown("README.md"))
        ))
))