OK, thanks for the help! Here a more complex example:
a=c("x","y","z") b=c(8,14,19) c=c(200010,535388,19929) data=data.frame(a,b,c) d=c("cat1","cat2","cat3","cat4","cat5","cat6") b1=c(14,5,8,20,19,1) c_start=c(500000,500000,200000,200000,18000,600000) c_stop=c(550000,550000,201000,201000,20000,700000) category=data.frame(d,b1,c_start,c_stop) Again I want to create a new variable, which automatically assigns the category to the data based on matching b = b1 and c >= c_start and <=c_stop. I hope this explains my problem more explicit. Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Assigning-entries-to-categories-tp2272697p2278334.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.