The data frame I have contains two colum: ID and type (character). See below:
set.seed(123)
ID <- seq(1,25)
type <- sample(letters[1:26], 25, replace=TRUE)
df <- data.frame(ID, type)
I need to create a new data frame that contain only one column. The first observation will be the first three letters in column type, the second observation is the second three letters, and soon on.
The new data looks like
ndf <- data.frame(ntype=c("huk", "wyb", "nxo", "lyl", "roc", "xgb", "iyx", "sqz", "r"))