Skip to content

Instantly share code, notes, and snippets.

View DrNickRedfern's full-sized avatar

Nick Redfern DrNickRedfern

View GitHub Profile
@DrNickRedfern
DrNickRedfern / normalisation_equation.svg
Last active July 23, 2025 11:03
Normalisation equation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DrNickRedfern
DrNickRedfern / openalex_curl_demo.ps1
Created December 11, 2024 09:50
OpenAlex curl demo
curl -H 'Content-Type: application/json' 'https://api.openalex.org/works?page=1&filter=default.search:early+onset+dementia,publication_year:2024' | Out-File openalex.json
@DrNickRedfern
DrNickRedfern / altmetric.json
Created September 4, 2024 09:15
JSON record returned from Altmetric API
{
"title": "Changes in health with the rise of industry",
"doi": "10.1016/j.ijpp.2022.12.005",
"pmid": "36645946",
"isbns": [
],
"altmetric_jid": "4f6fa61e3cf058f610007983",
"issns": [
"1879-9817",
@DrNickRedfern
DrNickRedfern / kyoto.omp.json
Created April 8, 2024 19:16
Kyoto: variation on the Tokyo theme for Oh My Posh
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"style": "plain",
"foreground": "#51829b",
"template": "\u2552[<#ffffff>\uF007</> {{ .UserName }}@{{ .HostName }}]",
{
"config": {
"terminology": {
"item": "Researcher",
"items": "Researchers",
"link": "Co-authorship link",
"links": "Co-authorship links",
"link_strength": "Co-authorships",
"total_link_strength": "Total co-authorships"
},
@DrNickRedfern
DrNickRedfern / control_flow_while.R
Last active September 8, 2022 10:19
An illustration of a while loop in R
# Set the initial value of a
a <- 1
# Print the current value of a while a is less than or equal to 5
while (a <= 5){
# Print the current value of a
print(a)
# Increment the value of a by 1
a = a + 1
}
@DrNickRedfern
DrNickRedfern / control_flow_loop.R
Last active September 8, 2022 09:40
An illustration of a for loop in R
a <- 1:3
b <- 4:6
# Loop over every element in a and print the result of the i-th elememt of a plus 10
for (i in seq_along(a)){
print(i + 10)
}
[1] 11
[1] 12
@DrNickRedfern
DrNickRedfern / control_flow_ifelse.R
Last active September 8, 2022 10:16
An illustration of an ifelse statement in R
a <- 2
if (a > 0){
print(paste0(a, " is a positive number"))
} else if (a < 0) {
print(paste0(a, " is negative number"))
} else {
print(paste0(a, " equals zero"))
}
@DrNickRedfern
DrNickRedfern / control_flow_if.R
Created September 8, 2022 08:52
An illustration of an if statement in R
# The code in the braces is run when the condition is true
a <- 2
if (a > 0) {print("positive")}
[1] "positive"
# The code in the braces is NOT run when the condition is false
b <- -3
if (b > 0) {print("positive")}
@DrNickRedfern
DrNickRedfern / vectorisation_2.R
Created September 8, 2022 07:58
Another illustration of vectorisation in R
# Create two vectors of equal length
X <- c(1, 3, 5, 8)
Y <- c(2, 4, 6, 7)
# Add the vectors together
X + Y
[1] 3 7 11 15