pfad = "/Volumes/Data_1/d" m = read.table(paste(pfad, "mary2.txt", sep="/"), header=F) cnames = c("spk", "city", "region", "vdur", "predur", "clodur", "reldur", "clorel", "preclorel", "vc", "cv", "vtype", "cplace", "ptonic", "word") colnames(m) = cnames x = y = rep("", nrow(m)) o = nchar(as.character(m[,1])) temp = o==20 x[temp] = substring(m[temp,1], 13, 20) y[temp] = substring(m[temp,1], 1, 12) temp = o==21 & substring(as.character(m[,1]), nchar(as.character(m[,1])), nchar(as.character(m[,1]))) %in% c("k", "t") x[temp] = substring(m[temp,1], 12, 19) y[temp] = substring(m[temp,1], 1, 11) temp = y =="" x[temp] = substring(m[temp,1], 14, 21) y[temp] = substring(m[temp,1], 1, 13) m[,1] = factor(x)