Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data package with golem and Shiny #632

Closed
ShinyFabio opened this issue Apr 1, 2021 · 2 comments
Closed

Data package with golem and Shiny #632

ShinyFabio opened this issue Apr 1, 2021 · 2 comments

Comments

@ShinyFabio
Copy link

Hello,
I'm developing a shiny app with golem. This app requires a lot of photos that are inside the www folder (with a lot of subfolders required by the app in order to show only some photos) and so the package is a bit heavy. Since these photos are not mandatory (the app works without them) I was thinking about create a data package that can be installed later if the user need them. Do you have any idea how to make it? Long story short, I need a data package that put all my photos in the www folder of my app, mantaining the subfolders structure.

@ColinFay
Copy link
Member

ColinFay commented Apr 2, 2021

Hey!

So, this part of the app_ui allows to link any folder of your server as a resource path for your app

https://github.com/ThinkR-open/golem/blob/master/inst/shinyexample/R/app_ui.R#L28

Here, you could specify any other path, for example with something like:

add_resource_path(
	'img', system.files('img', package = 'myotherpackage')
)

That way, you can link the folder from the other package.

If you want to link these only if the other package is installed, I'd suggest doing something like:

if (requireNamespace("myotherpackage"){
	add_resource_path(
		'img', system.files('img', package = 'myotherpackage')
	)
} 

Let me know if that works,

Colin

@ShinyFabio
Copy link
Author

Thank you! It looks perfect. I'm going to try your solution. I'll let you know later!

@ThinkR-open ThinkR-open locked and limited conversation to collaborators May 12, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants