Is there a count() function in R that tells how many elements of a vector meet a certain criterion? (Need it for generating contour plots.) Currently I use the somewhat cumbersome count<-length(v[v<7]) to determine, for example, the number of elements in v that are <7. (Note that count<-length(x[v<7]) would also work, where x is *any* vector that has the same length as v.) -- Art Salwin salwin at mitretek.org (202) 863-2985 (202) 863-2988 (fax) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 Tue, 28 Mar 2000, Art Salwin wrote:> Is there a count() function in R that tells how many > elements of a vector meet a certain criterion? (Need it for > generating contour plots.) > > Currently I use the somewhat cumbersome > count<-length(v[v<7]) to determine, for example, the number > of elementssum(v<7) works, too (if there are no NAs in v, which is necessary for your version too) If you are worried about NAs then you can do length(which(v<7)) or sum( v<7,na.rm=TRUE) -thomas Thomas Lumley Assistant Professor, Biostatistics University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear R users, What is the easiest way to construct an identity matrix? Thanks. Alan ___________________________________ Alan T. Arnholt Associate Professor Dept. of Mathematical Sciences Appalachian State University Boone, NC 28608 http://www.mathsci.appstate.edu/~arnholt/ Office phone: (828) 262 - 2863 Office fax : (828) 265 - 8617 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Plots under Win 95 show up in a window entitled RGraphics: Device 2. Is there a way to create additional plots in additional windows? Functions like plot.new or frame create a new plot in the same window, wiping out what was previously there. In effect, is there a way to have a Device 3, 4, 5, etc? -- Art Salwin salwin at mitretek.org (202) 863-2985 (202) 863-2988 (fax) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
windows() will open new graphical windows. it can take number of options (see help). -------------------------------------------------------- Vadim Kutsyy http://www.kutsyy.com vadim at kutsyy.com The University of Michigan - Ann Arbor Ph.D. Student> -----Original Message----- > From: owner-r-help at stat.math.ethz.ch > [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Art Salwin > Sent: Friday, July 14, 2000 2:43 PM > To: r-help at stat.math.ethz.ch > Subject: [R] R under Win 95-- question #2 > > > Plots under Win 95 show up in a window entitled RGraphics: > Device 2. > Is there a way to create additional plots in additional > windows? Functions like > plot.new or frame create a new plot in the same window, > wiping out what was previously there.__________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
win.graph() and read ?win.graph At 10:15 AM 14/07/2000 -1000, you wrote:>Plots under Win 95 show up in a window entitled RGraphics: >Device 2. >Is there a way to create additional plots in additional >windows? Functions like >plot.new or frame create a new plot in the same window, >wiping out what was previously there. > >In effect, is there a way to have a Device 3, 4, 5, etc? >-- >Art Salwin >salwin at mitretek.org >(202) 863-2985 >(202) 863-2988 (fax) >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._