Dear list, I have following data, where I want to check if any value in each column is out of range. For example, column "f1" can only take values 1-5, so if any values less than 1 or > 5 will be defined as missing value (i.e. NA), column "f4" can only take values of 1-3 and any values that are outside this interval will be considered as missing values. The below data is a subset of a big survey sample and I want to create an automatic procedure to check if all particpants gave a reasonable answer. How can I do this in R and also replace the empty values with NA? > dat id f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 1 1 5 3 1 1 1 1 2 1 1 1 2 2 5 5 1 1 1 1 2 1 1 2 3 3 3 4 1 1 1 1 2 1 1 1 4 4 5 5 1 1 1 1 1 1 1 1 5 5 4 3 2 1 2 2 1 2 3 6 6 4 4 1 2 2 1 2 1 1 1 7 7 4 4 1 1 1 2 3 2 2 2 8 8 4 5 2 2 2 2 2 2 2 2 9 9 4 4 2 3 3 3 3 3 3 3 10 10 4 3 1 2 3 1 2 1 2 3 11 11 2 5 1 1 2 1 3 1 1 2 12 12 4 3 1 2 3 3 3 3 2 3 13 13 5 5 1 1 1 1 2 1 1 2 14 14 5 3 3 3 3 2 1 3 1 1 15 15 4 3 1 1 1 2 2 2 1 2 16 16 3 2 2 3 2 3 3 2 2 3 17 17 4 5 1 1 1 1 2 1 1 1 18 18 3 3 2 2 3 2 3 2 3 3 19 19 4 4 1 2 2 2 3 2 3 3 20 20 4 4 1 2 3 3 3 2 3 3 Thanks in advance, Tom
--------------------------------- Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. [[alternative HTML version deleted]]
______________________________________________ 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.