R is often perceived as a specialized tool solely for statisticians, but this perception vastly underestimates its capabilities. While R excels in statistical analysis and data manipulation, it’s also a powerful, general-purpose programming language with a rich ecosystem, expressive data models, and elegant visualization tools. It’s a dynamic environment that goes far beyond basic number crunching.
Beyond Statistics: A Comprehensive Ecosystem #
At its core, R provides a robust foundation for statistical computing. Its extensive libraries (called “packages”) offer functions for virtually every statistical method imaginable, from simple descriptive statistics to advanced modeling techniques. R’s power, however, extends well beyond statistics to a wide range of tasks, including:
- Data Cleansing and Transformation: R offers powerful tools for cleaning, transforming, and reshaping data. Packages like
dplyrandtidyrprovide an intuitive grammar of data manipulation, making it straightforward to prepare data for analysis. - Data Visualization: R is renowned for its exceptional data visualization capabilities. The
ggplot2package, based on the Grammar of Graphics, allows users to create stunning and informative visualizations with a high degree of customization. Beyondggplot2, there are numerous other packages for interactive plots, maps, and specialized visualizations. - Interactive Web Applications (Shiny): The
shinypackage lets you build interactive web applications directly from R — ranging from simple dashboards to complex data exploration tools — without requiring extensive web development knowledge. - Machine Learning and Deep Learning: R has a thriving machine learning ecosystem, with packages like
caret,mlr3, andkeras(an interface to the popular Python deep learning library) providing access to a wide range of algorithms, including deep learning models. R’s powerful tools and libraries were instrumental in the optimization and refinement of the Apex algorithms. - Report Generation (R Markdown): R Markdown allows you to combine code, results, and narrative text in a single document, producing reproducible reports, presentations, and even entire books.
- And much more: R’s capabilities extend to geospatial analysis, text mining, bioinformatics, econometrics, and many other specialized fields.
Community-Driven Development: The CRAN Repository #
A key strength of R is its vibrant and active community. Developers worldwide contribute packages to the Comprehensive R Archive Network (CRAN), a central repository that makes it easy to install and use a vast collection of tools. This collaborative model ensures that R is constantly evolving, with new packages and features added regularly. Its open-source nature fosters innovation and keeps R at the forefront of data science.
This Website: A Testament to R’s Versatility #
This entire website was built within the RStudio platform — an integrated development environment (IDE) specifically designed for R. While HTML, JavaScript, and CSS handle styling and front-end interactivity, the core structure and content management were handled using R. This demonstrates R’s remarkable flexibility and its ability to extend well beyond traditional statistical applications. The blogdown package (built on Hugo) makes it possible to create static websites directly from R Markdown documents.
Create a Website with R #
These instructions will get you up and running with Hugo and Blowfish from a completely blank state. Most required dependencies can be installed using your platform’s package manager of choice. You can also follow the standard Hugo Quick Start guide to get up and running quickly.
Install Hugo #
If you haven’t used Hugo before, you will need to install it onto your local machine. You can check whether it’s already installed by running the command hugo version.
Detailed installation instructions for your platform are available in the Hugo docs.
Blowfish Tools (recommended) #
There is a CLI tool available to help you get started with Blowfish. It will create a new Hugo project, install the theme, and set up the theme configuration files automatically. It’s still in beta, so please report any issues you find.
Install the CLI tool globally using npm (or another package manager):
npx blowfish-tools
or
npm i -g blowfish-tools
Then run the command blowfish-tools to start an interactive session that will guide you through the creation and configuration process:
blowfish-tools
You can also run blowfish-tools new to create a new Hugo project and install the theme in one step. Check the CLI help for more information:
blowfish-tools new mynewsite
Here’s a quick video showing how fast it is to get started with Blowfish using the CLI tool:
Install without CLI #
Create a new site #
Run the command hugo new site mywebsite to create a new Hugo site in a directory named mywebsite.
You can name the project directory whatever you like, but the instructions below will assume it’s named mywebsite. If you use a different name, substitute it accordingly.
Download the Blowfish theme #
There are several different ways to install the Blowfish theme into your Hugo website. Listed from easiest to most complex to install and maintain:
- Git submodule (recommended)
- Hugo module
- Manual file copy
If you’re unsure, choose the Git submodule method.
Install using git #
This method is the quickest and easiest for keeping the theme up to date. Besides Hugo and Go, you’ll also need Git installed on your local machine.
Navigate into the directory for your Hugo website (created above), initialize a new git repository, and add Blowfish as a submodule:
cd mywebsite
git init
git submodule add -b main https://github.com/nunocoracao/blowfish.git themes/blowfish
Then continue to set up the theme configuration files.
Install using Hugo #
With this method, Hugo manages your themes. Hugo uses Go to initialize and manage modules, so ensure go is installed before proceeding.
-
Download and install Go. You can verify the installation with the command
go version.Make sure you are using Go version 1.12 or later, as Hugo requires this for modules to work correctly. -
From your Hugo project directory (created above), initialize modules for your website:
# If you're managing your project on GitHub hugo mod init github.com/<username>/<repo-name> # If you're managing your project locally hugo mod init my-project -
Add the theme to your configuration by creating a new file
config/_default/module.tomlwith the following content:[[imports]] disable = false path = "github.com/nunocoracao/blowfish/v2" -
Start your server with
hugo serverand the theme will be downloaded automatically. -
Continue to set up the theme configuration files.
Install manually #
-
Download the latest release of the theme source code.
Download from Github -
Extract the archive, rename the folder to
blowfish, and move it to thethemes/directory inside your Hugo project’s root folder. -
Continue to set up the theme configuration files.
Set up theme configuration files #
In the root folder of your website, delete the hugo.toml file that was generated by Hugo. Copy the *.toml config files from the theme into your config/_default/ folder. This ensures you have all the correct theme settings and makes it easy to customize the theme to your needs.
module.toml file if one already exists in your project.
Depending on how you installed the theme, the config files will be in different locations:
- Hugo Modules: In the Hugo cache directory, or download a copy from GitHub
- Git submodule or Manual install:
themes/blowfish/config/_default
Once you’ve copied the files, your config folder should look like this:
config/_default/
├─ hugo.toml
├─ languages.en.toml
├─ markup.toml
├─ menus.en.toml
├─ module.toml # only if you installed using Hugo Modules
└─ params.toml
theme = "blowfish" to the top of your hugo.toml file.
Next steps #
After installing Blowfish, build and serve your site following Mark Gingrass’s “Cradle to Grave R” YouTube series (Cradle to Grave R), specifically his tutorial “R Hugo Website. His comprehensive and clearly structured explanations are an excellent resource for this workflow. Once your site is running, you’re free to configure it to your needs.
Installing updates #
From time to time, new releases are published that apply fixes and add new functionality to the theme. To take advantage of these changes, you will need to update the theme files on your website.
The process depends on the installation method you originally chose. Instructions for each are below.
Update using git #
Git submodules can be updated with a single git command. Execute the following and the latest version of the theme will be pulled into your local repository:
git submodule update --remote --merge
Once the submodule has been updated, rebuild your site and verify everything works as expected.
Update using Hugo #
Hugo makes updating modules straightforward. Navigate to your project directory and execute:
hugo mod get -u
Hugo will automatically update any required modules by inspecting your module.toml and go.mod files. If you encounter any issues, verify that these files are still configured correctly.
Rebuild your site and confirm everything works as expected.
Update manually #
Updating Blowfish manually requires downloading the latest copy of the theme and replacing the old version in your project.
-
Download the latest release of the theme source code.
Download from Github -
Extract the archive, rename the folder to
blowfish, and move it to thethemes/directory inside your Hugo project’s root folder, overwriting the existing directory to replace all theme files. -
Rebuild your site and verify everything works as expected.