Package 'christmas'

Title: Generation of Different Animated Christmas Cards
Description: Generation of different Christmas cards, most of them animated, one for each year since 2008 except 2020. Most of the cards can be generated in three languages (English, Catalan and Spanish). Each card was created at Christmas to greet the coming New Year. From 2008 to 2018, the cards were shared by e-mail with colleagues, friends and students. Encouraged by some of them, the author gathered the whole collection into this package, first released on CRAN in 2019, and new cards have been added since then.
Authors: Jose Barrera-Gomez [aut, cre] (ORCID: <https://orcid.org/0000-0002-2688-6036>)
Maintainer: Jose Barrera-Gomez <[email protected]>
License: GPL (>= 3)
Version: 1.4.2
Built: 2026-11-28 22:15:39 UTC
Source: https://github.com/cran/christmas

Help Index


Caganer.

Description

A Catalan 'caganer' (created in 2009). Caganer is a figurine depicted in the act of defecation appearing in nativity scenes in Catalonia and neighbouring areas with Catalan culture such as Andorra, Valencia, and Northern Catalonia (in southern France). It is most popular and widespread in these areas, but can also be found in other areas of Spain (Murcia), Portugal, and southern Italy (Naples). Further details can be found at https://en.wikipedia.org/wiki/Caganer. This caganer won the annual contest of sustainable caganers at CREAL (now ISGlobal, https://www.isglobal.org/en/) in 2009.

Usage

xmascaganer(
  year = 2010,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2010.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot with a caganer.

Author(s)

Jose Barrera-Gomez.

Examples

xmascaganer()

Newton's cradle.

Description

Christmas cradle (created in 2026). Approximation to a Newton's cradle with three pendulums.

Usage

xmascradle(
  year = 2027,
  language = c("english", "spanish", "catalan"),
  restitution_coef = 0.6,
  motion = c("harmonic", "linear"),
  col_card = "palegoldenrod",
  col_rest = "red",
  col_moving = "darkturquoise",
  col_final = "forestgreen",
  col_mess = c("yellow", "red", "cyan", "violet", "white"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2027.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

restitution_coef

Numeric value in the open interval (0, 1) indicating the fraction of amplitude retained after each collision to simulate energy loss. Default is 0.6.

motion

Type of motion of the pendulums. One of c("harmonic", "linear"). "harmonic" (default) mimics a real pendulum (the ball accelerates while descending and decelerates while rising, without stopping at the top of each swing), whereas "linear" moves the ball with constant angular velocity and stops it briefly at the top of each swing. Both kinds of motion have the same swing duration.

col_card

Background color of the card (the graphics window). It must be opaque (no transparency), because the pendulums are erased by drawing over them with this color. The colors of the balls and of their wires are drawn over it. Default is "palegoldenrod".

col_rest

Color of a ball while it is at rest during the motion of the system. Default is "red".

col_moving

Color of a ball while it is moving (and of the left ball at the beginning, when it is about to fall). Default is "darkturquoise".

col_final

Color of the three balls when the system stops. Default is "forestgreen".

col_mess

Vector of at least three colors from which the colors of the three pieces of the message are randomly chosen (without replacement). The message is written on the balls once they have turned col_final, so these colors should contrast with it. Default is c("yellow", "red", "cyan", "violet", "white").

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including an approximation to a Newton's cradle animation.

Note

The animation was improved with the assistance of Claude Sonnet 5.5 (Anthropic): the flickering was removed by erasing the previous position and drawing the next one between dev.hold() and dev.flush(), and the balls are drawn in plot coordinates, so they scale with the plot.

Author(s)

Jose Barrera-Gomez.

Examples

xmascradle()
xmascradle(year = 2027, language = "catalan")

Christmas epitree.

Description

A statistical/epidemiological Christmas tree (created in 2016). This tree is built using a random subset of statistical and epidemiological words.

Usage

xmasepitree(year = 2017, seed = NULL)

Arguments

year

Year to be printed. Default is 2017.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a tree made of nice words.

Author(s)

Jose Barrera-Gomez.

Examples

xmasepitree()

Christmas flag.

Description

Christmas flag (created in 2015). A flag with a Christmas message.

Usage

xmasflag(
  year = 2016,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2016.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a message in a flag.

Author(s)

Jose Barrera-Gomez.

Examples

xmasflag(year = 2020, language = "catalan")

Fractal Christmas tree.

Description

The tree (created in 2024) fractal structure was adapted from (https://blogs.sas.com/content/iml/2012/12/14/a-fractal-christmas-tree.html). A preliminary translation to R was written by Alejandra Cabana (UAB).

Usage

xmasfractaltree(year = 2025, language = c("english", "spanish", "catalan"))

Arguments

year

Year to be printed. Default is 2025.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

Value

A Christmas card plot including a fractal Christmas tree.

Author(s)

Jose Barrera-Gomez.

Examples

xmasfractaltree()

Christmas Galton card.

Description

Christmas Galton (created in 2018). A Christmas tree in the Galton board. This is an adaptation of quincunx() in package animation, which simulates the Galton board (https://en.wikipedia.org/wiki/Bean_machine).

Usage

xmasgalton(
  year = 2019,
  language = c("english", "spanish", "catalan"),
  balls = 240,
  layers = 15,
  onlyBoard = FALSE,
  treeballs = 15,
  time = 0.02,
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2019.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

balls

The number of balls in the board. Default is 240.

layers

The number of layers in the board. Default is 15.

onlyBoard

Logical. If FALSE (default), an empirical Christmas normal tree estimated from data is added to the histogram.

treeballs

The number of balls to be added to the Christmas normal tree. Default is 15.

time

Elapsed time, in seconds, between two consecutive balls in the board. Default is 0.02.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas tree in a Galton board.

Author(s)

Jose Barrera-Gomez.

Examples

# more balls, less layers:
xmasgalton(balls = 300, layers = 9, time = 0.01)
# no balls in the gaussian christmas tree:
xmasgalton(balls = 400, layers = 11, time = 0.005, treeballs = 0)

Christmas risks.

Description

Christmas risks (created in 2011). Some epidemiological jokes about potential effects of Christmas on health.

Usage

xmashealth(year = 2012, seed = NULL)

Arguments

year

Year to be printed. Default is 2012.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including boxplots and OR estimates.

Author(s)

Jose Barrera-Gomez.

Examples

xmashealth()

Christmas helix.

Description

Christmas helix (created in 2023). A helix with a Christmas message.

Usage

xmashelix(
  year = 2024,
  language = c("english", "spanish", "catalan"),
  totalsecs = NULL,
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2024.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

totalsecs

Approximate total time, in seconds, to create the card. Default is NULL (and it is internally set).

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a message in a helix.

Author(s)

Jose Barrera-Gomez.

Examples

xmashelix(year = 2024, language = "catalan", totalsecs = 1)

Neon Christmas card.

Description

Christmas card using a neon sign (created in 2013 for New Year 2014).

Usage

xmasneon(
  language = c("english", "spanish", "catalan"),
  nflash = 30,
  pause = 0.1,
  seed = NULL
)

Arguments

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

nflash

Number of flashes shown in the neon sign. Default is 30.

pause

Pause, in seconds, between two consecutive flashes shown in the neon sign. Default is 0.1.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a message and then a simulations of a neon sign.

Author(s)

Jose Barrera-Gomez.

Examples

xmasneon()
xmasneon(language = "catalan", nflash = 10, pause = 0.05)
xmasneon(nflash = 100, pause = 0.01)

Peaceful Christmas tree.

Description

Christmas card (created in 2025) including a tree Christmas tree whose leaves are created with the word "peace" in 32 languages. This is the first card in this collection created by interacting with AI (Gemini Flash 2.5).

Usage

xmaspeace(
  year = 2026,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2026.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a tree and wishing a peaceful year.

Author(s)

Jose Barrera-Gomez.

Examples

xmaspeace()

Picasso's pigeon.

Description

Approximation to Picasso's pigeon (created in 2022).

Usage

xmaspicasso(
  year = 2023,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2023.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including an approximation to Picasso's pigeon.

Author(s)

Jose Barrera-Gomez.

Examples

xmaspicasso()
xmaspicasso(year = 2023, language = "catalan")

Christmas regression model.

Description

A plot of the Christmas regression model (created in 2019).

Usage

xmasregression(
  year = 2020,
  language = c("english", "spanish", "catalan"),
  time = 4,
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2020.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

time

Total time, in seconds, for the card generation. Default is 12.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

An illustration of the Christmas regression model.

Author(s)

Jose Barrera-Gomez.

Examples

xmasregression()
xmasregression(year = 2021, language = "catalan", time = 2)

Koch snowflakes.

Description

Koch snowflakes (created in 2012). Koch snowflakes (https://en.wikipedia.org/wiki/Koch_snowflake) are used to print the Christmas message in three languages (English, Catalan and Spanish).

Usage

xmassnowkoch(year = 2013, seed = NULL)

Arguments

year

Year to be printed. Default is 2013.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including Koch snowflakes.

Author(s)

Jose Barrera-Gomez.

Examples

xmassnowkoch()

Christmas snowman.

Description

Christmas snowman (created in 2014).

Usage

xmassnowman(
  year = 2015,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2015.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a snowman.

Author(s)

Jose Barrera-Gomez.

Examples

xmassnowman(year = 2015, language = "catalan")

Christmas message.

Description

A random repetition of a message (created in 2010). Random allocation of repetitions of the Christmas message.

Usage

xmastext(
  year = 2011,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2011.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including the repetition of the same message randomly allocated.

Author(s)

Jose Barrera-Gomez.

Examples

xmastext(year = 2011, language = "spanish", seed = 666)

Naive Christmas tree.

Description

A random naive Christmas tree (created in 2008).

Usage

xmastree(
  year = 2009,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2009.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a random tree.

Author(s)

Jose Barrera-Gomez.

Examples

xmastree(year = 2020, language = "catalan", seed = 666)

Christmas shaped tree.

Description

Christmas trees (created in 2017) with different shapes.

Usage

xmastreeshape(
  year = 2018,
  language = c("english", "spanish", "catalan"),
  shape = c("piramidal", "oval", "vshaped", "round", "columnar"),
  nballs = 15,
  ballscolor = NULL,
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2018.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

shape

The shape of the tree. One of c("piramidal", "oval", "vshaped", "round", "columnar"). Default is "piramidal".

nballs

The number of balls in the tree. Default is 15.

ballscolor

The colors to be used for the balls in the tree. It must be a vector with names of colors included in colors(), or NULL (default). If NULL, then colors are randomly selected.

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a christmas tree.

Author(s)

Jose Barrera-Gomez.

Examples

xmastreeshape(shape = "oval", language = "catalan", ballscolor = "blue")
xmastreeshape(shape = "vshaped", nballs = 15, ballscolor = c("sienna2", "yellow2", "tomato"),
              seed = 1111)
xmastreeshape(shape = "columnar", nballs = 20, ballscolor = "red")

Wire Christmas tree.

Description

A random wire Christmas tree (created in 2021).

Usage

xmastreewire(
  year = 2022,
  language = c("english", "spanish", "catalan"),
  seed = NULL
)

Arguments

year

Year to be printed. Default is 2022.

language

Language to be used in the card. One of c("english", "spanish", "catalan"). Default is "english".

seed

Seed for reproducibility of the card. Default is NULL (no seed).

Value

A Christmas card plot including a random wire tree.

Author(s)

Jose Barrera-Gomez.

Examples

xmastreewire(year = 2020, language = "catalan", seed = 666)