Hi
[EMAIL PROTECTED] napsal dne 25.10.2008 19:19:45:
> #is this what you want?
> x <- c(-10, -5, 0, 5, 10, 15, 20)
> y <- c(10, 10, 10, -5, -6, -7, 10)
> data <- data.frame(x, y)
> subset(data, x>0 & y==min(y))
Not exactly. But maybe
y.val=which(data$y==min(data$y))
x.val=which(data$x>0)
data[x
Hi Jim.
jim holtman schrieb:
> If you only want the first sequence,
Yes, that's true, I forgot to say that!
>> x <- c(-10, -5, 0, 5, 10, 15, 20)
>> y <- c(10, 10, 10, -5, -6, -7, 10)
>> data <- as.matrix( cbind(x, y) )
>> # if you only want the first 'run', then use 'rle' to find it
>> mask <-
If you only want the first sequence, then this might work:
> x <- c(-10, -5, 0, 5, 10, 15, 20)
> y <- c(10, 10, 10, -5, -6, -7, 10)
> data <- as.matrix( cbind(x, y) )
> # if you only want the first 'run', then use 'rle' to find it
> mask <- data[,1] > 0 & data[,2] > min(data[,2])
> run <- rle(mask
#is this what you want?
x <- c(-10, -5, 0, 5, 10, 15, 20)
y <- c(10, 10, 10, -5, -6, -7, 10)
data <- data.frame(x, y)
subset(data, x>0 & y==min(y))
On Sat, Oct 25, 2008 at 12:33 PM, Martin Ballaschk <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm not very experienced with R and struggle with data selecti
Hi,
I'm not very experienced with R and struggle with data selection from a long
matrix with two columns.
I want to cut out the data between x > 0 and min(y).
> x <- c(-10, -5, 0, 5, 10, 15, 20)
> y <- c(10, 10, 10, -5, -6, -7, 10)
> data <- as.matrix( cbind(x, y) )
> data
x y
[1,] -10
5 matches
Mail list logo