2

so I have a Shiny app where I'm trying to read in a user-identified input file.

Towards that end, my ui.R has the line fileInput("predictor2", label = "Predictor Values") and I try to read the file using the line predictor <- read.delim("input$predictor2") in my server.R file.

However, I get a message saying Error: Cannot open the connection. If I don't try to read in the file and use another matrix of values, the code works fine. Any advice for how to fix this problem or more detail that would be useful?

1 Answer 1

2

You code is looking for a file with the literal name input$predictor2 which presumably does not exist. You first need to remove the quotes from around it, then add which column of the return actually has the path to the data, e.g.:

read.delim(input$predictor2$datapath)

See the help for fileInput for an example that checks to make sure something has been uploaded first.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Mark, that's perfect! I don't know how I didn't see that in the fileInput documentation earlier

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.