I am trying to use Shiny to make a UI that accepts a user uploaded excel file and performs analysis on it. I ran into a problem using the mixfit function from the mixR package.
I tried to isolate the mixfit function in a separate app so I know what is happening:
# Define the server logic for the Shiny application
server <- function(input, output) {
observeEvent(input$testMixfit, {
# Generate some test data with a fixed seed for reproducibility
set.seed(123)
test_data <- rnorm(100)
# Debug print to ensure test_data exists
print("Generated test data:")
print(test_data)
tryCatch({
mixfit_result <- mixfit(test_data, ncomp = 2)
# Debug print the mixfit result
print("Mixfit result:")
print(mixfit_result)
but the error that it puts out is:
[1] “Error in mixfit call:”
<simpleError in eval(mc, environment()): object ‘test_data’ not found>
I’ve also tried using reactive values, creating the random data inside the function, and other methods but I still run into this issue.
RenXavier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
0