Complete the code blocks below to make one slider, one reactive expression, and two interactive pieces of text. After each code chunk, re-render the document to check your progress for errors.

# create a slider input that selects a number, include negatives and use step = 0.5
sliderInput(inputId = "number", label = "Slide me!", 
            min = -10, max = 10, value = 0, step = 0.5)
# create a reactive expression that rounds the slider value to the nearest whole number (with `round()`) and then returns the absolute value (with `abs()`).
clean <- reactive(abs(round(input$number)))

The square of your number:

# Create a piece of rendered text that shows the square of the rounded number (e.g., n^2)
renderText(clean()^2)

The factorial of your number:

# Create a piece of rendered text that shows the factorial of the rounded number (with factorial)
renderText(factorial(clean()))


rstudio/reportsWS documentation built on May 28, 2019, 5:42 a.m.