R GIS: Interpolating and Plotting Corn Grain Yield Data

■ Python GIS: Interpolating and Plotting Corn Grain Yield Data In my previous post, I explained how to create a GIS map using Python. Today, I’ll introduce how to create the same GIS map using R. First, let’s install all the required packages. and I’ll upload a dataset for practice. Next, I’ll extract columns for … Read more

Graphing Normal Distributions with Varied Variances

I want to create a normal distribution graph with a specific variance. First, it’s necessary to create the data. I’ll generate data with a mean of 100 and a variance of 100 (which means the standard deviation is 10). However, it’s important to establish a range. To do this, I’ll set up a range of … Read more

[R package] Calculation for Growing Degree Days (GDDs, ºCd)

Growing Degree Days (GDDs) are a measure of heat accumulation used to predict crop development rates such as the growth of crops. The GDDs are calculated to provide a simple model to estimate the growth and development of plants, especially crops, based on the daily temperature. To calculate GDDs, the base temperature for each crop … Read more

[R package] Prediction of Grain Weight and Area in Bread Wheat (feat. kimindex)

These days, image analysis equipment can easily provide grain area measurements (mm²), and the large datasets acquired instantly from this equipment offer more insights into wheat grains. While grain weight can be a good indicator of wheat yield, obtaining data on grain weight is challenging with the available equipment. Currently, average grain weight is calculated … Read more

[R package] Probability Distribution and Z-Score Calculation Function (feat. probdistz)

■ Introduction ■ What is Probability Density Function (PDF) and Cumulative Distribution Function (CDF): How to calculate using Excel and R? In my previous post, I explained what the Probability Density Function (PDF) and the Cumulative Distribution Function (CDF) are. I also explained the formula for the PDF and demonstrated how to manually calculate it in Excel. … Read more

[R package] Finlay-Wilkinson Regression model (feat. fwrmodel)

■ What is Finlay-Wilkinson Regression Model? In my previous post, I introduced what Finlay-Wilkinson Regression Model is and how to calculate adaptability (or stability). Actually, adaptability and stability are opposite concept with the same data. Have you ever heard heritability (h2)? Heritability is a key concept in genetics and breeding that measures how much of … Read more

Stepwise Regression: A Practical Approach for Model Selection using R

Stepwise selection, forward selection, and backward elimination are all methods used in the context of building statistical models, specifically regression models, where the goal is to select the most relevant predictors. In this section, I’ll introduce one by one. Let’s generate one dataset. This dataset includes grain yield data, along with measurements of stem biomass, … Read more

In R, how to check the data structure?

When uploading data to R, we first need to check the data structure before analyzing it. Here are some tips for checking the data structure in R. First, I’ll upload a dataset from my GitHub. In this dataset, let’s check the structure of the data. ■ Code to display the first or last certain rows … Read more

Coding Light Spectrum Curves for Plant Growth in R

Let’s say we collected relative light intensity data across a wide range of the light spectrum in an LED experiment. and I’d like to create light spectrum curves regarding relative light intensity. First, I’ll define wavelength colors. The color at different ranges of wavelengths is always the same, so if we run this code, we … Read more

[Data article] Data Normalization Techniques: Excel and R as the Initial Steps in Machine Learning

In my previous post, I introduced the necessity of data normalization in visualizing data. By following that post, you may gain an understanding of how we can organize data according to our preferences. □ Why is data normalization necessary when visualizing data? Today, I’ll introduce various methods for data normalization, utilizing the biomass with N … Read more

[Data article] Why is data normalization necessary when visualizing data?

Data normalization is necessary when visualizing data for several key reasons, and I believe the most important reason is for scale uniformity. Different data variables can have vastly different scales and units. For example, grain yield might be in Mg/ha, while nutrient contents might typically range from %. Normalizing these data to a common scale … Read more

How to draw a y-axis border when using facet_wrap() in R? (feat. scales=”free”)

Here is one dataset, and I’ll use facet_wrap() to create bar graphs. First, let’s summarize the data. Then, I’ll create a bar graph using facet_wrap() to divide panels by irrigation. Now, I want to draw a y-axis border for the ‘Irrigation_Yes’ panel. We can achieve this simply by adding scales=”free”. We aim to develop open-source … Read more

How to randomize treatments using R?

Setting up experimental design according to your experiment goal is the first step to achieve your experiment’s success. In Agronomy studies, experimental design involves the combination of treatments deployed in the field, and these treatments should be randomized. Randomization is important in experimental design as it helps our experiments avoid biases due to physical or … Read more

Achieving Smooth Curve Graphs with R

□ How to convert character to POSIXct format in R? In my previous post, I created a curve graph like the one shown below. The curve on the graph appears to be not very smooth, and I want to make it smoother. Therefore, I will add geom_smooth(), but the method will be method=”gam” code summary: … Read more

How to convert character to POSIXct format in R?

Here is one dataset Let’s check the data type of each variable. The time column is in character format. When opening the data in Excel, it is considered text. I wish to create a time series graph, but this cannot be accomplished when the variables are in text format. Therefore, we need to convert the … Read more

How to add separate text to panels divided by facet_wrap() in R?

In my previous posts, I introduced how to divide panels in one figure using facet_wrap(). Today, I’ll introduce how to add separate text to panels. First, let’s make sure we have the required packages installed. I’ll create a dataset as shown below: Next, I’ll reshape the dataset into columns to facilitate data analysis. And then, … Read more

How to Perform Cumulative Sum in R?

This is R code to calculate cumulative sum. 1) Data created 2) Cumulative Sum per group 3) datacume() function To make this process easier, I developed an R function, datacume(). For details, please read the post below. 1) Install the function 2) Run the code © 2022 – 2023 https://agronomy4future.com

How to run R codes in Google Colab?

Google Colab is essentially a Jupyter notebook environment, which means that typically only Python code works. However, it is also possible to use R code in Google Colab. If you’re unfamiliar with Google Colab, please read the post below to grasp its general concept. □ How to use Google Colab for Python (power tool to … Read more

How to convert an uploaded data to code in R?

Let’s upload one dataset to R. Now, I want to save this data as code so that I can store it in my web note. This is because it would be difficult to find the original dataset after a long time. Therefore, I want to save it as text code in a list on my … Read more

Customizing R Graphs: Splitting Text into Two Rows

I have a dataset as below. Now, I want to create a bar graph about this data. First, let’s summarize the data. Then, let’s create a bar graph. Now, to save space, I’d like to split the x-axis text into two rows using the following code. When you run the same code to create a … Read more

A Practical Approach to Linear Mixed-Effects Modeling in R

A Linear Mixed-Effects Model (LMM) is a statistical model that combines both fixed effects and random effects to analyze data with repeated measurements or hierarchical structure. Let’s break down the key components and concepts of a Linear Mixed-Effects Model: 1) Fixed Effects: 2) Random Effects: 3) Linear Mixed-Effects Model Equation: The general equation of a … Read more

Step-by-Step Guide to Calculating and Adding Variable Means in R

Here is one dataset. I want to add the mean of each treatment to a new column, and I am using the following code. However, the code is quite lengthy. Let’s simplify it using tapply() How about there are more variables? Now, I want to add the mean of the combination of treatment and environment. … Read more