Dear R Community, We have recently installed R 1.5.0 on several workstations. Ever since, if I try to extract certain numbers or lines from a file (which contains many NA's), I don't only get my desired line but all other lines which contain NA's. In a file with 15000 rows and 7500 NA's this is not very practical. In the earlier R-Version this worked when I typed in the following: a <- konz[konz[,17] == 1061 | konz[,17] == 1017,4:17] In this case, vector 'a' contained columns 4:17 of every row in file 'konz' in which column 17 equaled 1061 or 1017, and nothing else. Since R 1.5.0 is installed I also get all rows in which row 17 of 'konz' contains NA's (and that's many). Any hint how I can avoid this? Thanks, Patrick Buetzberger -------------- next part -------------- A non-text attachment was scrubbed... Name: patrick.vcf Type: text/x-vcard Size: 339 bytes Desc: Card for Patrick Buetzberger Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020506/18df1f9f/patrick.vcf
Dear Patrick a <- konz[(konz[,17] == 1061 | konz[,17] == 1017) & !is.na(konz[,17]),4:17] Should do the job Ole Patrick Buetzberger wrote:> > Dear R Community, > > We have recently installed R 1.5.0 on several workstations. Ever since, > if I try to extract certain numbers or lines from a file (which contains > > many NA's), I don't only get my desired line but all other lines which > contain NA's. In a file with 15000 rows and 7500 NA's this is not very > practical. In the earlier R-Version this worked when I typed in the > following: > > a <- konz[konz[,17] == 1061 | konz[,17] == 1017,4:17] > > In this case, vector 'a' contained columns 4:17 of every row in file > 'konz' in which column 17 equaled 1061 or 1017, and nothing else. Since > R 1.5.0 is installed I also get all rows in which row 17 of 'konz' > contains NA's (and that's many). > > Any hint how I can avoid this? > > Thanks, Patrick Buetzberger-- Ole F. Christensen Department of Mathematics and Statistics Fylde College, Lancaster University Lancaster, LA1 4YF, England -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Patrick Buetzberger <patrick at giub.unibe.ch> writes:> Dear R Community, > > We have recently installed R 1.5.0 on several workstations. Ever since, > if I try to extract certain numbers or lines from a file (which contains > > many NA's), I don't only get my desired line but all other lines which > contain NA's. In a file with 15000 rows and 7500 NA's this is not very > practical. In the earlier R-Version this worked when I typed in the > following: > > a <- konz[konz[,17] == 1061 | konz[,17] == 1017,4:17] > > In this case, vector 'a' contained columns 4:17 of every row in file > 'konz' in which column 17 equaled 1061 or 1017, and nothing else. Since > R 1.5.0 is installed I also get all rows in which row 17 of 'konz' > contains NA's (and that's many). > > Any hint how I can avoid this?Try subset() instead. (This has always been so, btw. In S-PLUS too.) Or use the %in% operator, which doesn't give NA results. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 6 May 2002, Patrick Buetzberger wrote:> Dear R Community, > > We have recently installed R 1.5.0 on several workstations. Ever since, > if I try to extract certain numbers or lines from a file (which contains > > many NA's), I don't only get my desired line but all other lines which > contain NA's. In a file with 15000 rows and 7500 NA's this is not very > practical. In the earlier R-Version this worked when I typed in the > following: > > a <- konz[konz[,17] == 1061 | konz[,17] == 1017,4:17] > > In this case, vector 'a' contained columns 4:17 of every row in file > 'konz' in which column 17 equaled 1061 or 1017, and nothing else. Since > R 1.5.0 is installed I also get all rows in which row 17 of 'konz' > contains NA's (and that's many). > > Any hint how I can avoid this?Read the NEWS file or the file up 150update.txt on developer.r-project.org. Your code has always been incorrect .... -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._