Category: R
How to Calculate Trimmed Means in R (Examples)
A trimmed mean is a mean trimmed by x%, where x is the percentage of observations removed from both the upper and lower bounds. For instance, 10% trimmed mean is the mean computed by excluding th 10% largest and 10%...
Read Full Article →
How to Use Mean() In R with Examples
mean() can be used to calculate mean in R. The following is the basic statement. mean(x, trim = 0, na.rm = FALSE) x: It is an R object. trim: It is in the range of (0 to 0.5). The number indicates the percentage...
Read Full Article →
How to Plot 2-Way ANOVA Interaction in R (with Example)
This tutorial shows how to plot the figure for the interaction in 2-way ANOVA in R. Steps of Plotting 2-Way ANOVA Interaction in R Step 1: Prepare the data The following is the data being used for the examples. It...
Read Full Article →
How to Use stringsAsFactors in R
stringsAsFactors decides the strings will be considered as factors or just strings or characters. The following uses two examples to explains the difference. Example 1: stringsAsFactors= FALSE The following sets stringsAsFactors= FALSE. We can see that the data type of...
Read Full Article →
How to Calculate Means by Group in R (2 Examples)
This tutorial is about how to calculate means by group in R. There are two methods of calculating means by groups in R, either aggregate() or dplyr. Method 1: Use base R aggregate(df$col_being_aggregated, list(df$col_1_groupby,df$col_2_groupby,...), FUN=mean) Method 2: Use package of...
Read Full Article →
Calculate Sum of Squares Total (SST) in R (2 Examples)
This tutorial shows how to calculate Sum of Squares Total (SST) in R. The following is the data being used. The hypothetical data being used has two categorical IVs (cities and stores) and one DV (sales). Note that, while it...
Read Full Article →
Overview of Type I, Type II, and Type III ANOVA in R (with Examples)
This tutorial explains what Type I, Type II, and Type III ANOVA are. Further, it provides examples showing how you can do Type I, Type II, and Type III ANOVA in R. 1. Introduction Type I, Type II, and Type...
Read Full Article →
Why Type I ANOVA is Sequential Sum of Squares (R code example)
Type 1 ANOVA is also called sequential sum of squares, because it considers the order effect of entering factors into the model. If you change the order of the factors in the model, the results will be different. The following uses...
Read Full Article →
How to Conduct Two-Way ANOVA in R
This tutorial shows how you can do two-way ANOVA in R with examples. A two-way ANOVA is used to test whether the means from the two or more categorieal variables are significantly different from one another. For instance, below, there are two categorical...
Read Full Article →
R Vetors
Vectors are a basic data object in R. There are six types of vectors, namely logical, integer, double, complex, character and raw. You can use a c() function to create vectors, and the following shows the examples. 1. Logical Vector...
Read Full Article →