Hi, May be this helps: vec1 <- c("Humanities, Multidisciplinary; Social Sciences, Interdisciplinary; History", "History","Sociology; Religion","Humanities, Multidisciplinary;","Social Sciences, Interdisciplinary","Literature","Sociology; Religion")
res1 <- as.data.frame(table(unlist(strsplit(vec1,split="; ?")))) #or res2 <- as.data.frame(table(strsplit(gsub(";+",";",paste(vec1,collapse="; ")),"; ?")[[1]])) identical(res1, res2) #[1] TRUE Regarding sorting, check ?sort() or ?order. res2[order(res2$Var1),] A.K. Hi, I'm new user to R. I've a list of terms in vector x, for example: 1 Humanities, Multidisciplinary; Social Sciences, Interdisciplinary; History 2 History 3 Sociology; Religion 4 Humanities, Multidisciplinary; Social Sciences, Interdisciplinary 5 Literature 6 Sociology; Religion I need split for ';' the variable x, sort by name or by count, into new variable and count. For example: Humanities, Multidisciplinary 2 History 2 Sociology 2 Religion 2 Literature 1 Social Sciences, Interdisciplinary 2 I don't know how many time ";" appears Thanks. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.