Re: [R] Borders on a polygon

2010-06-07 Thread Sean Anderson
On Mon, Jun 7, 2010 at 6:55 PM, beloitstudent wrote: > [...] I am trying to do some shading in R and am using the polygon() setting. > I want the border on the top and bottom of the polygon, but not on the left > and right. [...] One way would be to add the borders after as lines. For example: pl

Re: [R] writing a matrix in a file

2010-06-02 Thread Sean Anderson
On 10-06-02 10:34 AM, amir wrote: I want to write a matrix (n*m) in a file (Text file) such that the file will be as Result file (below). I use the below command but it write all numbers in one column, write(paste(matrixname),file="test.txt",append=TRUE) how can I do this? ... Matrix:

Re: [R] persp(); help with 'tck' option

2010-05-26 Thread Sean Anderson
On Wed, May 26, 2010 at 8:53 PM, Kim Jung Hwa wrote: > I'm using 'tck' option to *reduce* the length of tick marks but it is not > working, can anyone please tell me where I'm going wrong... > > require(graphics) > require(grDevices) > x <- seq(-10, 10, length= 30) > y <- x > f <- function(x,y) { r

Re: [R] lines on plot

2010-05-20 Thread Sean Anderson
On 2010-05-20, at 2:38 PM, Anthony Lopez wrote: > Is there an easier way to make this graph *without* having to specify all of > the separate segment arguments at the end? > ... > axis(2,at=2:7,lab=c("2","3","4","5","6","7")) > segments(0,2,2.3,2) > segments(0,3,2.3,3) > segments(0,4,2.3,4) > segm

Re: [R] Histogram Bin

2010-05-14 Thread Sean Anderson
On Fri, May 14, 2010 at 10:55 AM, Research wrote: > Is there a function that returns the number of the "bin" (or quantile, or > percentile etc. etc.) that a value of a variable may belong to? Something like this should work: dat <- round(runif(20, 0, 100)) hist.dat <- hist(dat, plot = FALSE) ge

Re: [R] intersect

2010-05-11 Thread Sean Anderson
wrote: > how can I test every element in a vector whether appears in another vector? > such as > a<-c("aa", "bb", "ff", "cc") > b <-c("oo","jj","bb","cc") a %in% b [1] FALSE TRUE FALSE TRUE __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] removing duplicate rows

2010-05-11 Thread Sean Anderson
On Tue, May 11, 2010 at 9:07 PM, Jim Bouldin wrote: > > I'm trying to identify and remove rows in a data frame that are duplicated > only on particular columns within it (i.e. not on all columns). This is probably the cleanest way: dat <- data.frame(x = c(1, 2, 3), y = c(1, 1, 3)) subset(dat, !d