Le vendredi 18 novembre 2011 à 15:06 +0000, Mario Giesel a écrit : > Hello, list, > > I've been struggling with this task for a while looking for an efficient way > to solve it: > There are two variables 'price' and 'mentioned'. > I want to 'enlarge' data so that missing price points within the price range > are added to variable price. > Also variable 'mentioned' is to receive values 0 in these cases. > Note: Price points in original data can repeat if several persons mentioned > that price point. Let's say prices1 holds the first list of prices, prices2 the supplementary one. Try: prices <- c(prices1, prices2) prices <- sort(prices[!duplicated(prices)]) data.frame(price=prices, mentioned=prices %in% prices1)
Regards ______________________________________________ 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.