Error: argument 'x' must be numeric

46 views
Skip to first unread message

Iasmim Louriene

unread,
Oct 20, 2016, 8:59:50 PM10/20/16
to Shiny - Web Framework for R
Hello guys, I'm trying to create a histogram of density and I'm having the error: argument 'x' must be numeric. I tried to use (as.numeric(input$d)) instead of just d but got the same error. Does anyone know how to solve this?

output$hist <- renderPlot({

input$action

if(is.null(input$action))
return(NULL)

else

isolate({

trees3 <- FindTreesCHM(chm(), (as.numeric(input$fws)), (as.numeric(input$minht)))
d <- density(trees3["height"])
plot(d, xlab = "Height", ylab = "Density", main = "")
polygon((as.numeric(input$d)), col = "darkseagreen")

})
})

Thanks a lot! :)

Joe Cheng

unread,
Oct 20, 2016, 10:19:37 PM10/20/16
to Iasmim Louriene, Shiny - Web Framework for R
I'd call browser() just inside the isolate(), and step through the calculation one line at a time to see whether d and other variables are what you expect. And when you figure it out, remove the browser() call.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/29474b4f-a75c-44bf-956d-5d3447951f39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Iasmim Louriene

unread,
Oct 24, 2016, 7:31:29 PM10/24/16
to Shiny - Web Framework for R
Thanks Joe!
Reply all
Reply to author
Forward
0 new messages