This repository contains code and instructions to draw a Christmas tree using the crayon
package in R, as explained in the Medium article by Linus Chirchir.
This project demonstrates how to use the crayon
package in R to draw a festive Christmas tree. The tree is created using simple R code, making it a great example of how to create art with code. Follow the steps below to replicate the tree and learn more about the process.
Before you begin, ensure you have the following installed:
- R (version 3.6 or later)
- RStudio (optional, but recommended for ease of use)
crayon
package
To get started, you need to install the crayon
package. You can do this directly from CRAN:
install.packages("crayon")
Clone this repository to your local machine:
git clone https://github.com/your-username/christmas-tree-crayon.git
cd christmas-tree-crayon
The main script for drawing the Christmas tree is included in the tree.R
file. You can run this script in your R environment:
source("tree.R")
This script uses the crayon
package to color and create the tree shape directly in the R console.
Feel free to customize the tree by modifying the script:
- Colors: Change the colors of the tree, decorations, or star by adjusting the
crayon
functions. - Tree Size: Modify the size of the tree by altering the loop parameters or the number of lines in the script.
- Decorations: Add more decorations or change their positions to create a unique design.
This project is licensed under the MIT License - see the LICENSE file for details.
Happy coding and Merry Christmas! 🎄