Trying to get shiny to work

This is the code I am trying to get this code to work under shiny

ui <- fluidPage(
    sliderInput(inputId = "number",
                label =  "Select a number",
                value = 500, min = 50, max = 1000),

server <- function(input, output) {
    histdata <- reactive({
        runif(input$number, min=0, max=1)
    output$hist <- renderPlot({
        main=paste(input$number, "Random values between 0 and 1")
    output$mean <- renderText({paste("Mean =",round(mean(histdata()),3)
    output$median <- renderText({paste("Median =",round(median(histdata()),3)
    output$sd <- renderText({paste("Standard Deviation =",round(sd(histdata()),3)

shinyApp(ui = ui, server = server)

but I keep getting two errors

  1. Error in fluidpage(sliderInput(inputId = "number", lable = "Select a number", :
    could not find function "fluidpage"

  2. Error in getCurrentRegistryId() :
    function 'Rcpp_precious_remove' not provided by package 'Rcpp'

Can anyone help me on how to fix these?

worked perfectly fine in my rstudio
Maybe you can try reinstalling rcpp

Hey, I was able to figure it out. all the packages were not selected that I needed

I have a new problem if you don't mind taking a look.
here is my code

library(tibble) <- drop_na(mtcars)

options <- c("Cyl" = "Cylinders",
"HP" = "Horsepower",
"qsec" = "1/4 mile time",
"vs" = "Engine")
df.options <- data.frame(options) <- rownames_to_column(df.options)
colnames( <- c("lable", "value")

ui <- fluidpage(
selectInput("X", "X Variable:",
selectInput("Y", "Y Variable:",

server <- function(input, output) {
selections<- reactive({[, c(input$X, input$Y)]
output$scatter <- renderplot({
x_column <- selections()[,1]
y_column <- selections()[,2]

    correlation <- cor(x_column, y_column)
    regression <- lm(y_column ~ x_column)
    intercept <- regression$coefficients[1]
    slope <- regression$coefficients[2]
    X_Lable <-$lable[which($value == input$X)]
    Y_Lable <-$lable[which($value == input$Y)]
    plot(x=x_column, y=y_column, xlab = X_Lable, ylab = Y_Lable,
         cex.axis = 1.5, cex.lab= 1.5, pch = 20, cex = 2,
         main = paste(Y_Lable, "vs", X_Lable,
                      "\n r =", round(correlation,3),"
            Y' =", round(intercept,3), "+", round(slope,3), "X"),
    abline(intercept, slope)


shinyApp(ui = ui, server = server)

I get an error when the page comes up "unidentified columns selected"
I have messed with the drop downs but nothing.

I don't know exactly what I need to do

  1. You have made mistakes while creating the named list called options
    And there are some unnecessary variables you've created without which you can do just fine.
  2. The variables are case sensitive, they should be "cyl", "hp"
    The purpose of the named vector is to give users, readable input options and it parses that input as a corresponding value as you defined.
    For example: if you have created vector c("Cylinders" = "cyl"), the UI will show Cylinders as an option and when you will be calling that input in server, it reads as cyl which is the actual variable name.
You can refer to this documentation to get a much better idea.
Try running it and understanding the logic behind it.

Oh, thank you I didn't even realize that. I was able to change those around and it ended up working. Thank you!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.