Thanks Jorge,
It worked.
A.K.
From: Jorge I Velez
To: arun
Cc: R help
Sent: Wednesday, May 30, 2012 6:11 PM
Subject: Re: [R] Extracting rows from a dataset
Hi A.K.,
Thank you for the example.
Here is one way:
dat[apply(dat, 1, function(x) x[1] == 1
Hello,
Try the following.
ix <- apply(dat, 1, function(x) x[1] == 1 && sum(diff(x) != 0) > 1)
dat[ix, ]
Hope this helps,
Rui Barradas
Em 30-05-2012 22:45, arun escreveu:
Dear R help,
I have a dataset with 1's and 0's. Here, each row is the observation for an insect. If the animal is pres
Hi A.K.,
Thank you for the example.
Here is one way:
dat[apply(dat, 1, function(x) x[1] == 1 & length(rle(x)$values) > 2), ]
See ?rle and ?apply for more details.
HTH,
Jorge.-
On Wed, May 30, 2012 at 5:45 PM, arun <> wrote:
> Dear R help,
>
> I have a dataset with 1's and 0's. Here, each r
Dear R help,
I have a dataset with 1's and 0's. Here, each row is the observation for an
insect. If the animal is present in light area at a particular time, response
is 1 and if it is present in dark area, the response is 0. I would like to do
some formating on the data for analysis. To be
4 matches
Mail list logo