Browsed by
Tag: ifelse()

How to Convert Time to Numeric for Line Graphs in R?

How to Convert Time to Numeric for Line Graphs in R?

Here is one dataset. With this data, I’ll create a line graph to show the change in day length over time. First, let’s transpose the columns to rows using pivot_longer(). I’ll sort the data by Day and Month, but since the month column is in text format, sorting it from January to December directly isn’t feasible. Therefore, I’ll add a number corresponding to each month for sorting purposes. Now, I can sort by ‘month1’ and ‘Day’ from January 1 to…

Read More Read More

Exploring Best Linear Unbiased Estimators (BLUE) through Practical Examples in R

Exploring Best Linear Unbiased Estimators (BLUE) through Practical Examples in R

□ The Best Linear Unbiased Estimator (BLUE): Step-by-Step Guide using R (with AllInOne Package) In my previous post, I explained how to use R to perform the Best Linear Unbiased Estimator (BLUE). Now, this is a practical exercise focusing on BLUE in R. Here is one dataset. I have data on grain number (GN) and average grain weight (AGW) in winter wheat for about five genotypes and one transgenic line. The study examines the response to disease resistance (yes or…

Read More Read More

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

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 have used the IF function as shown above. Then, you can categorize organic matter in the F column as shown above. Now, my next question…

Read More Read More