Title: | My personal R tools |
---|---|
Description: | This package collects some functions I created for myself to facilitate certain tasks. I do not expect it to be very useful for anyone else, but if you think this can help you out, be my guest! |
Authors: | Bart Rogiers [cre, aut] |
Maintainer: | Bart Rogiers <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2025-01-20 04:42:07 UTC |
Source: | https://github.com/rogiersbart/bro |
Animate a set of pngs
animate( dir, gif = "animation.gif", regexp = NULL, glob = NULL, delay = 2, loop = TRUE, max_size = 1200, repeat_last = 2 )
animate( dir, gif = "animation.gif", regexp = NULL, glob = NULL, delay = 2, loop = TRUE, max_size = 1200, repeat_last = 2 )
This behaves the same way as launching git bash through the start menu, explorer context menu or executable directly. The HOME environment variable is adjusted, as R uses the Documents subfolder of the standard HOME directory in git bash, so ".bash_profile" is correctly sourced on startup. The working directory will correspond to that of the R session.
bash()
bash()
Download photos from ouders.broekx.be
broekx_download(url = NULL, to = NULL)
broekx_download(url = NULL, to = NULL)
url |
Email link to a page with images. If NULL (default), the URL is taken from the clipboard. |
to |
Directory to save the images. If NULL (default), the current working directory is used. |
Title
drive_download(id)
drive_download(id)
id |
Google drive file id |
Edit a file in RStudio
edit(path)
edit(path)
path |
Initiate a new hugrid site for local testing
gallery_init(drive_folder)
gallery_init(drive_folder)
This function allows you to create an image gallery type of website, using the hugo hugrid theme, with minimal setup in a google drive folder. Files in the folder starting with the folder/project name are omitted. The rest is processed in order, and added to the items.toml file. Everything works by linking to google drive, so files are hosted there, but all files should hence be available through a shared link. Details for setup are provided below.
gallery_items(drive_folder, path = "data/items.toml")
gallery_items(drive_folder, path = "data/items.toml")
drive_folder |
full path to google drive folder without trailing slash |
path |
path to the |
Every image file should start with a code, then a name, and finally a
type, separated with underscores (e.g. code_name_type.jpg
). Types can be
thumb
, for the thumbnail images on the main page grid, image
for the
image used for display when the thumbnail is clicked, and url
for the file
that is linked to when clicking the button that is foreseen in the theme.
If other types are included, these are added as separate buttons, by appending an html tag to the description (explained below). For the button text, the type is used, but underscores are replaced by spaces.
A csv file should be included as well, with a column code
that links
the rows with the image files, and columns title
and description
, which
are displayed next to the image
type file.
Download high-resolution photos from gimme.eu based on a saved html
gimme_download(path = getwd(), max_size = 4000)
gimme_download(path = getwd(), max_size = 4000)
path |
folder where you saved the album html page, and the individual photos should be put instead, defaults to current working directory |
max_size |
maximum number of pixels for image width and height, defaults to 4000 |
Shift
+ Right-click in the Windows file Explorer allows you to copy a file path, but it has backslashes. With this function, you get the forward slash version, so it can be used inside your R code.path_fix(path)
path_fix(path)
path |
Path to process. If missing, the path is read from the clipboard. |
The fixed path, invisibly.
Plain text week planning
plan_week(file = NULL, previous = NULL)
plan_week(file = NULL, previous = NULL)
file |
File to write to, or "clipboard". |
The text, invisibly if written first to a file.
Plain text year planning
plan_year(file = NULL, year = lubridate::year(lubridate::today()))
plan_year(file = NULL, year = lubridate::year(lubridate::today()))
file |
File to write to, or "clipboard". |
year |
The year to use, defaults to the current year. |
The text, invisibly if written first to a file.
Setup dotfiles
setup_dotfiles(scope = "user")
setup_dotfiles(scope = "user")
scope |
Edit globally for the current user, or locally for the current project |
Invisible NULL.
Setup PowerToys
setup_powertoys()
setup_powertoys()
Invisible NULL.
Shortcuts for interactive use
pkg(name) last() serve() git()
pkg(name) last() serve() git()
name |
Package name to check |
The rsthemes solarized themes are used here, as they provide more consistent use of italics, better highlighting, etc. as the built-in solarized themes.
toggle() light() dark()
toggle() light() dark()