By David Okul
I have been intrigued by R ever since I completed my master’s degree in 2014. But for the past 11 years, it’s been one of those things I’ve consistently put off—classic procrastination. That ends now. I’m switching gears and committing to learning R, and I’ll be documenting the entire journey on my website.
I am taking an 8-hour course on LinkedIn by Prof Barton Poulson. It can be accessed on this link https://www.linkedin.com/learning/complete-guide-to-r-wrangling-visualizing-and-modeling-data/recoding-quantitative-data
The notes are highly based on the content of the link, but I am also getting additional notes from other sources.
What is R Statistics?
It is a powerful programming language and environment designed for statistical computing and graphics. It’s widely used for data analysis, visualization, and statistical modeling. Key aspects of R include its ability to handle large datasets, create publication-quality graphics, and perform various data manipulation and analysis tasks.
Excel is perhaps the most common tool used globally while working with data, the universal data containers. However, majority of the taks in Excel do not need modelling.
In contrast, professional data scientist need ultimate control of data using tools such as R, Python, Julian etc.
The Basics very Basics
- Open RStudio.
- “File Menu.
- Open File
- Select file on the location
Getting started With R
Download and Install R depending on the operating system. This is done on the CRAN website. After installing R, you can choose to install interphases to enhance the user experience. I chose to install R studio.
Data types for R vary, and mainly include vectors, matrix, array, list and so on.
Packages give R an additional functionality. Packages are a set of R codes, sample data and compiled data. By default, a set of packages are available upon installation of R.
The general command for installing packages is
install.packages(“package name”)
Tidyverse is a collection of packages widely used in R and introduced by Hadley Wickham. A key feature of tidyverse is the encouragement of piping, especially the magrittr pipe (%>%). It is also argued that Tidyverse is a good introduction to R for beginners, like myself. Some of the most common packages in tidyverse include:
- ggplot2 – for data visualization
- dplyr – for wrangling and transforming data
- tidyr – help transform data specifically into tidy data, where each variable is a column, each observation is a row; each row is an observation, and each value is a cell.
- readr – help read in common delimited, text files with data
- purrr – a functional programming toolkit
- tibble – a modern implementation of the built-in data frame data structure
- stringr – helps to manipulate string data types
- forcats – helps to manipulate category data types\
Other common packages include (pacman, a package management tool) and rio (for importing data). A package could be installed, but it needs to be loaded using the library command for it to be usable.
Import Data in R
The Council can impose duties related to climate change on any public entity at all levels of government in consultation with cabinet secretaries and county governments.
Each state department and national government agency shall integrate climate action plans into sectoral strategies. They also need to report on GHG emissions for national inventory
The Council can also impose climate change obligations on private entities.
National Environmental Management Authority (NEMA) is mandated to monitor whether private or public entities are complying
The act provides provisions for mainstreaming climate change in strategic areas for state departments and corporations, including county governments.
Part IVA: Regulations of Carbon Markets
the section mentions that the Cabinet Secretary will provide additional requirements on the regulation of carbon markets.
Every carbon trading project is required to undergo an environmental and social impact assessment in accordance with the Environmental Management and Coordination Act. Additionally, REDD+ projects will also need safeguards standards assessments.
Every land project shall be implemented via a community development agreement. CDAs will be registered in the registry. Annual social contributions of the earnings of the previous year shall be disbursed to the community (At least 40% for land-based projects and 25% for non-land-based projects.
Part V: Public Participation and Access to Information
Public entities at each level of government shall, at all times when developing strategies, laws and policies relating to climate change, undertake public awareness and conduct public consultations.
Any person can request information from the Council or Directory; but they have rights not to give information under some circumstances (24.6).
Part VI: Financial provisions
Climate Change Fund vested in the National Treasury. The fund is administered by the Council.
The funds shall be applied for research, business, adaptation and mitigation projects, and technical assistance for counties.
Part VII: Miscellaneous provisions
Various aspects are listed in the miscellaneous section including public engagement, conflict of interest issues, and personal liabilities.
Further, it outlines offenses and penalties. For instance, a fine of KES 10 million or 5 years in prison for failing to comply with instructions of the Council. Additionally, wrongly engaging in carbon credit training attracts a fine of KES 500 million or 10 years in prison
Part VII: Delegated Legislation
The act proposes various regulations to operationalize it. For example:
- the regulation of carbon markets (signed in 2024)
- the regulation of carbon trading;
- the regulation of carbon registries
- the regulation of non-market approaches
- the delegation of the Council’s functions or powers
Concluding remarks
The previous bill (Climate Change Act 2016) did not include carbon trading and market frameworks. As such, the amended law (and its various regulations) provides a mechanism to enhance Kenya’s role in fighting climate change. it establishes NEMA as the DNA
I (David Okul) am an environmental management professional with over 15 years of experience in nature finance, donor projects, conservation, forestry, ecotourism, and community-based natural resources management. When not working on environmental projects, I spend my time writing for Silvica on a variety of topics. The views in this blog are personal and do not represent the organizations that I have associations with