comparison

Fitted vs predict in R

There are two functions in R that seems almost similar yet different: fitted() predict() First let’s prepare some data first. # Packages library(dplyr) # Data set.seed(123) dat <- iris %>% mutate(twoGp = sample(c("Gp1", "Gp2"), 150, replace = T), #create two group factor twoGp = as.

Base R vs tidyverse

First of all, this write up is mean for a beginner in R. Things can be done in many ways in R. In facts, R has been very flexible in this regard compared to other statistical softwares.

Loop vs apply in R

I have heard quite a several times that apply function is faster than loop function in R. Loop function is said to be inefficient, though in certain situation loop is the only way.