Skip to content

Commit

Permalink
Guard against the custom package not being available by first checkin…
Browse files Browse the repository at this point in the history
…g if the package is present and, then, loading it.
  • Loading branch information
coatless committed Jan 27, 2024
1 parent 741086e commit 6bdb14f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _extensions/webr/qwebr-document-engine-initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async function qwebrInstallRPackage(packageName) {

// Function to load a single package
async function qwebrLoadRPackage(packageName) {
await mainWebR.evalRVoid(`library(${packageName});`);
await mainWebR.evalRVoid(`if(requireNamespace('${packageName}', quietly = TRUE)) { library(${packageName}); }`);
}

// Generic function to process R packages
Expand Down

0 comments on commit 6bdb14f

Please sign in to comment.