Category Archives: R

Clustering in R

There is a nice post at https://stackoverflow.com/questions/15376075/cluster-analysis-in-r-determine-the-optimal-number-of-clusters that provide a number of examples to illustrate how to determine number of clusters. Below are two examples: # prepare data from a dataframe # var1 includes one group # var2 includes second group … Continue reading

Share
Posted in R, R/S-Plus | Tagged , , , , | Leave a comment

GET BLUE or BLUP from lmer in R

The following text is copied and pasted from https://stats.stackexchange.com/questions/122218/why-do-the-estimated-values-from-a-best-linear-unbiased-predictor-blup-differ. Q: Why do the estimated values from a Best Linear Unbiased Predictor (BLUP) differ from a Best Linear Unbiased Estimator (BLUE)? I understand that the difference between them is related to … Continue reading

Share
Posted in R, R/S-Plus | Tagged , , , , , , | Leave a comment

Dealing with Date in R language

In R there is a class called Date. If we want to get the components of a date variable or date string, we can use the following function to do it. toNumerics <- function(Date) { stopifnot(inherits(Date, c(“Date”, “POSIXt”))) day <- … Continue reading

Share
Posted in R, R/S-Plus | Leave a comment