Hi, there. Can I ask how to set up missing values in R? Suppose I want to assign the missing value to the elements in vector which is greater than zero like this: x<-c(1,3,-1,0,4); after the missing value assignment, x becomes (NA,NA,-1,0,NA). Thanks! Yulei $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Yulei He 1586 Murfin Ave. Apt 37 Ann Arbor, MI 48105-3135 yuleih at umich.edu 734-647-0305(H) 734-763-0421(O) 734-763-0427(O) 734-764-8263(fax) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
x[x>0] <- NA James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623>>> Yulei He <yuleih at umich.edu> 10/27/03 04:05PM >>>Hi, there. Can I ask how to set up missing values in R? Suppose I want to assign the missing value to the elements in vector which is greater than zero like this: x<-c(1,3,-1,0,4); after the missing value assignment, x becomes (NA,NA,-1,0,NA). Thanks! Yulei $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Yulei He 1586 Murfin Ave. Apt 37 Ann Arbor, MI 48105-3135 yuleih at umich.edu 734-647-0305(H) 734-763-0421(O) 734-763-0427(O) 734-764-8263(fax) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
One way: x<-c(1,3,-1,0,4)> x[x>0]<-NA > x[1] NA NA -1 0 NA>bob -----Original Message----- From: Yulei He [mailto:yuleih@umich.edu] Sent: Monday, October 27, 2003 4:05 PM To: r-help@stat.math.ethz.ch Subject: [R] how to set missing values in R Hi, there. Can I ask how to set up missing values in R? Suppose I want to assign the missing value to the elements in vector which is greater than zero like this: x<-c(1,3,-1,0,4); after the missing value assignment, x becomes (NA,NA,-1,0,NA). Thanks! Yulei $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Yulei He 1586 Murfin Ave. Apt 37 Ann Arbor, MI 48105-3135 yuleih@umich.edu 734-647-0305(H) 734-763-0421(O) 734-763-0427(O) 734-764-8263(fax) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help [[alternative HTML version deleted]]
See the recent discussion about is.na() on this list. You can do what you want as> x<-c(1,3,-1,0,4) > is.na(x) = x > 0 > x[1] NA NA -1 0 NA Yulei He <yuleih at umich.edu> writes:> Hi, there. > > Can I ask how to set up missing values in R? Suppose I want to assign the > missing value to the elements in vector which is greater than zero like > this: > > x<-c(1,3,-1,0,4); > > after the missing value assignment, x becomes (NA,NA,-1,0,NA).
>R-Users,Everyone, I am a new user of R and I was wondering if anyone could point me to a reference (book or article) that discusses writing population simulations in R (or S). Thanks in advance, Bret A. Collier Arkansas Cooperative Fish and Wildlife Research Unit Department of Biological Sciences SCEN 513 University of Arkansas Fayetteville, AR 72701 (479) 575-4720 bacolli at uark.edu