Skip to content

Unable to download from browser #5

Description

@GoldenStone929

Great project! I am going to paste the solution here just in case someone experiences the same issue in the future.

Screenshot 2024-08-23 153519

Here is the solution:

# Set global encoding to UTF-8
options(encoding = "UTF-8")

# Load the necessary packages
library("BayesianPredictiveFutility") # Load the package for the Shiny application
library("shiny") # Load the Shiny package for running the application 

# Get the path of the Shiny application inside the 'BayesianPredictiveFutility' package
# `system.file()` automatically finds the location of the specified file or directory 
# within the installed package, so it converts the relative path to an absolute path.
appDir <- system.file("[find relative path of App.R inside the package]", package = "BayesianPredictiveFutility")

# Check if the path is correct
if (appDir == "") {
  stop("Could not find the example directory. Please try reinstalling the `BayesianPredictiveFutility` package.", call. = FALSE) 
  # call = FALSE means that the error message will not include the line number of the stop() function
} else {
  cat("Example path found: \n", appDir, "\n") # Print the path to the console if found 
}

# Run the Shiny application
shiny::runApp(appDir, launch.browser = TRUE) # Launch the app in the default browser



Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions