I would like to position a long text on the right side of this Shiny app, as shown on the screenshot below.
library(quanteda)
library(shiny)
library(tm)
library(tidytext)
library(tidyverse)
library(shinydashboard)
library(shinythemes)
war <- readLines("war.txt")
war_corpus <- corpus(war)
sentences <- tokens(war_corpus,what="sentence")
make_sentences <- function(word) {
grep(word,sentences,value=TRUE)}
make_sentences("prince")
ui<- shinyUI(fluidPage(
# Application title
mainPanel(
img(src='image.jpg', align = "right"),
#titlePanel(title=div(img(src="image.jpg"))),
fluidRow(HTML("<strong> Search Bar")),
#fluidRow(HTML(" <strong>Date: 06-29-2020</strong>") ),
fluidRow(
br(),
p("User Name : ")),
br(),
br(),
fluidRow(HTML("<strong>Enter a word.Click \"Next words\" after</strong>") ),
fluidRow( p("\n") ),
# Sidebar layout
sidebarLayout(
sidebarPanel(
textInput("inputString","Enter a word here",value = " "),
submitButton("Next words")
),
mainPanel(
h4("Are you looking for this ?"),
tags$style("#mytext {white-space: pre-line;}"),
verbatimTextOutput("mytext")
)
)
)))
server <- function(input, output, session) {
output$mytext <- renderPrint({
sentences <- make_sentences(input$inputString)
length(sentences)
cat(paste0(1:length(sentences)," ",sentences,sep= '\n'))
})
}
here is the rcloud link of the project to experiment with : https://rstudio.cloud/project/1497912