Enhancing Visualizations: Manipulating Color and Shape in R with Two Variables

I have one dataset as below. Now, I’ll create a regression graph between grain number (GN) and average grain weight (AGW). I distinguished genotypes with different colors, and now I want to differentiate resistance (yes and no) using distinct shapes. Therefore, I’ll be changing the shape representation from genotype to resistance. However, the color is … Read more

Performing Regression Analysis in R with Variables in the Same Column

When analyzing regression, we typically assume that two continuous variables are situated in separate columns, allowing us to easily designate them as x and y. However, in many cases, data is organized vertically, and variables of interest are found within the same column. This vertical structuring is, in fact, the fundamental data arrangement when conducting … Read more

Equivalent Functions: IF function in Excel vs. ifelse() in R

When working with Excel, I believe you use the IF function from time to time, especially when categorizing values. The IF function is particularly useful for this purpose. Here is one example. I want to categorize organic matter (%) by unit 1.0. This process involves converting numeric variables to categorical variables. To achieve this, I … Read more

Efficient Multivariate Summary in R: A Guide to Analyzing Multiple Independent Variables

In my previous post, I introduced how to summarize data, such as mean, standard deviation, and standard error. However, at that moment, I demonstrated how to summarize only one variable. □ Streamlined Data Summary in R STUDIO: Enhancing Bar Graphs with Error Bars Now, let’s discuss this further with a dataset. I would like to … Read more

Efficient Multivariate Summary in R: A Guide to Analyzing Multiple Independent Variables (2/2)

In my previous post, I introduced how to summarize data using dplyr(). Let’s upload a dataset and summarize the data by calculating the mean, standard deviation, and standard error. Here’s an alternative method to summarize the data. We aim to develop open-source code for agronomy ([email protected]) © 2022 – 2025 https://agronomy4future.com – All Rights Reserved. … Read more

How to delete and change specific texts within a column in R?

When we want to change texts within a columns, you can have several methods which I already introduced before. □ How to Rename Variables within Columns in R? However, changing all texts and specific texts would be different. Let’s upload a data. Now, we can change the variables name as following code: How about changing … Read more

How to Upload and Combine Multiple Files In R?

In a folder, I have 5 different .csv files. I want to upload these files to R and combine all of them because the data format (number of columns and structure) is the same. While you can certainly upload them one by one, imagine a scenario where you have 100 datasets. Will you upload all … Read more

Calculating Predicted Values for Each Group in Basic Modeling

□ The Best Linear Unbiased Estimator (BLUE): Step-by-Step Guide using R (with AllInOne Package) In my previous post, I explained how to estimate dependent values from fitting models. Now I’ll explain how to add this predicted value to the original data using R. First, let’s upload data to R. Now, I’ll predict yield using the … Read more

How to calculate responsiveness in response to control using R?

In my previous post, I explained how to quantify phenotypic plasticity and introduced the concept of ‘responsiveness.’ □ Quantifying Phenotypic Plasticity of Crops I introduced a formula to calculate responsiveness as (Treatment – Control) / Control. Genotype Control Treatment Responsiveness A 100 90 -10.0% B 120 70 -41.7% C 115 90 -21.7% D 95 85 -10.5% … Read more

How to customize the title format in facet_wrap()?

By following my previous post, you can understand how to obtain the figure below. If you copy and paste the code above into your R console, you can obtain the same figure as shown above. Now, I’d like to change the title format by removing the title border. Next, I’d like to draw a line … Read more

Variable-Dependent Manipulation of Point and Line Sizes in R

I will randomly create a piece of data and then proceed to plot a line graph with points for this data. I have differentiated point colors and shapes based on the variable “Genotype”. In the above code, the value geom_point(size=5) sets the point size to 5 for both GenotypeA and GenotypeB. However, I would like … Read more

Drawing Lines in ggplot()

When using ggplot() to create multiple graphs, there are times when you might want to add separate lines to the graphs. Today, I’ll be posting about how to draw additional lines on graphs. Let’s start by generating a simple piece of data. Next, I will proceed to draw a regression graph for this data. 1) … Read more

Two-Way ANOVA Tutorial Using SAS Studio

I will introduce how to perform a Two-Way ANOVA analysis using SAS Studio. Here is the data that you have available: Upload this Excel file to SAS Studio. After uploading the Excel file to SAS Studio, create a data table named “EXP1” in My Libraries. Then, click on the EXP1 data table. Then, select the … Read more

Quantifying Phenotypic Plasticity of Crops

Phenotypic plasticity refers to the ability of an individual organism, in this case, a plant, to display varying phenotypic traits or characteristics in response to different environmental conditions. These traits can include physical features, physiological processes, and behaviors. Phenotypic plasticity is a crucial adaptive mechanism that allows organisms to optimize their survival and reproduction in … Read more

Statistical Inference on Binomially Distributed Data

The primary purpose of our experiment is to validate hypotheses regarding the population of the subjects under study. As a result, the experimenter must determine whether to accept or reject these hypotheses based on the experiment’s results. In this context, the method of statistical analysis will vary depending on whether the sample data follows a … Read more

Graph Partitioning Using facet_grid() in R Studio

In my previous post, I introduced how to partition graphs using facet_wrap(). Today, I’ll introduce facet_grid(). □ Graph Partitioning Using facet_wrap() in R Studio Actually, the function is the same, but there are very subtle differences between facet_wrap() and facet_grid(). Today, I’ll explain this. Let’s upload one data. I measured chlorophyll contents in leaves for … Read more

[데이터 칼럼] 데이터의 시각화에서 데이터 정규화가 필요한 이유는 무엇일까?

데이터의 정규화는 여러 가지 주요 이유로 데이터를 시각화 할 때 필요한데, 가장 중요한 이유는 척도의 균일성 (scale uniformity) 때문입니다. 서로 다른 데이터 변수들은 크게 다른 척도와 단위를 가질 수 있습니다. 예를 들어, 곡물 수확량은 Mg/ha 일 수 있고, 영양소 함량은 일반적으로 % 범위 내에 있을 수 있습니다. 이러한 데이터를 정규화 하면 단위가 다른 여러 개의 … Read more

R-Squared Calculation in Linear Regression with Zero Intercept

Previously, I scanned wheat grains to obtain the area of each grain, and then measured the weight of each grain corresponding to its area in order to develop a model equation. The following regression demonstrates the relationship between grain area and weight. You can download this data in Kaggle. # Data download https://www.kaggle.com/datasets/agronomy4future/wheat-grain-area-vs-weight Alternatively, you … Read more

[STAT article] Two-Way ANOVA: An Essential Tool for Understanding Factorial Experiments

A factorial experiment involves the simultaneous manipulation of multiple factors or independent variables (x) to study their effects on a dependent variable (y). The experiment is called factorial because it involves testing multiple factors simultaneously. In factorial experiments, the combination of the different levels of each factor being tested is called a factorial, and each … Read more

How to reorder variables in R for data analysis?

I’ll now show you how to change the order of variables in a graph. For this example, I have prepared some data and will create a graph using it. Now, let’s re-order the variables so that Calcium Nitrate comes first, followed by Urea, then Sodium Nitrate, and lastly Ammonium Sulfate. First, let’s take a look … Read more

How to Rename Variables within Columns in R?

If you need to change the text of a specific column while analyzing data in R, I will introduce how to do it. First, let’s create a simple dataset First, let’s rename the column names. We will change the ‘Nation’ column name to ‘Country’ and the ‘Sex’ column name to ‘Gender’. If you enter the … Read more