Skip to content
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

Suppress the folder path setup #97

Open
nicucalcea opened this issue Sep 22, 2023 · 7 comments
Open

Suppress the folder path setup #97

nicucalcea opened this issue Sep 22, 2023 · 7 comments

Comments

@nicucalcea
Copy link

Thank you for this excellent package.

I am a building a workflow to improve the accessibility of my plots, and I would like to use the VI function in BrailleR to automatically generate some boilerplate text that I can then edit to be more specific.

Since I plan on sharing this workflow with my colleagues and also put it up on GitHub, I was wondering if there is a way to suppress the path selection setup functions? Essentially, my package would only invoke the VI function on a plot, so it would be redundant to create a permanent folder, and I would like to avoid unnecessary steps for my users.

Let me know if this is possible, and if not, I'm happy to suggest a solution and/or submit a PR.

Thanks again!

@ajrgodfrey
Copy link
Owner

ajrgodfrey commented Sep 22, 2023 via email

@nicucalcea
Copy link
Author

Thanks for the prompt reply, Jonathan!

I am already calling the function directly in my package. Not an expert on this, but I think that because the setup function runs in .onLoad rather than .onAttach, so it gets called every time any function from the package is invoked.

I understand your concern about the alt text. I am a journalist who works with data, so I completely agree about what the alt graph should be. In fact, my editors would not publish an alt text that is automated anyway.

My newsroom uses an R package that exports graphs in the right size and styling for our website. My plan is to add a step in the export that checks whether the plot has alt text declared in labs(alt = "Alt text here"), and if not, pop a warning in the console. I was thinking it would be good to have the result of BrailleR::VI() offered as a starting point. It would print something like this to the console:

✖ Did you forget to include alt text? You can do so in labs(alt = "This is some text describing the chart.").
→ Here's something to get you started: Output from BrailleR goes here

Hope that helps explain what I'm trying to accomplish. Obviously, this should be a low priority for you and not something worth changing if it interferes with how the package functions.

@HenrikBengtsson
Copy link
Contributor

In SetupBrailleR() you ask the user for their permission to store files in ~/MyBrailleR/. This is required because the CRAN Policies require the user's permission for storing files in user's home directory. However, you can, without permission, store files under:

Folder = tools::R_user_dir("BrailleR", which = "config")

That way, you can avoid having the prompt in the first place. That folder is permanent, and in the user's home folder. On Linux, it defaults to ~/.config/R/BrailleR/.

This is what the CRAN Policies says:

For R version 4.0 or later (hence a version dependency is required or only conditional use is possible), packages may store user-specific data, configuration and cache files in their respective user directories obtained from tools::R_user_dir(), provided that by default sizes are kept as small as possible and the contents are actively managed (including removing outdated material).

Source: https://cran.r-project.org/web/packages/policies.html

R 4.0.0 was release on 2020-04-28, so 3.5 years ago now.

@ajrgodfrey
Copy link
Owner

ajrgodfrey commented Sep 23, 2023 via email

@hughjonesd
Copy link

If the MyBrailleR folder only needs to be created for certain functions, why not check for its existence only when those functions are called? That way you don't need to concern yourself with whether the package is attached or not. It seems like package attachment is an orthogonal issue.

@nicucalcea
Copy link
Author

My concern is that people might find it confusing if they receive a prompt to set up a library they're not familiar with, but if it happens in the background, I think that would be okay.

@hughjonesd
Copy link

Right, but why's that better if you do it onLoad than on calling a function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants