Hi
my favourite would be
test$v[which(test$pattern==1)]<-NA
Regards
Petr
> Hi,
>
> On Mar 1, 2012, at 12:38 PM, Sarah Goslee wrote:
>
> > Hi,
> >
> > On Thu, Mar 1, 2012 at 11:11 AM, mails wrote:
> >> Hello,
> >>
> >>
> >> consider the following data.frame:
> >>
> >> test <- data.frame(
On Mar 1, 2012, at 1:02 PM, Sarah Goslee wrote:
You're all correct: I copied in the wrong thing. My apologies!
On Thu, Mar 1, 2012 at 1:00 PM, Ista Zahn wrote:
Hi,
On Mar 1, 2012, at 12:38 PM, Sarah Goslee wrote:
Hi,
On Thu, Mar 1, 2012 at 11:11 AM, mails wrote:
Hello,
consider the f
You're all correct: I copied in the wrong thing. My apologies!
On Thu, Mar 1, 2012 at 1:00 PM, Ista Zahn wrote:
> Hi,
>
> On Mar 1, 2012, at 12:38 PM, Sarah Goslee wrote:
>
>> Hi,
>>
>> On Thu, Mar 1, 2012 at 11:11 AM, mails wrote:
>>> Hello,
>>>
>>>
>>> consider the following data.frame:
>>>
>>
Hi,
On Mar 1, 2012, at 12:38 PM, Sarah Goslee wrote:
> Hi,
>
> On Thu, Mar 1, 2012 at 11:11 AM, mails wrote:
>> Hello,
>>
>>
>> consider the following data.frame:
>>
>> test <- data.frame(n = c(1,2,3,4,5), v = c(6,5,7,5,3), pattern =
>> c(1,1,NA,1,NA))
>>
< snip >
>> So basically the resu
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of mails
> Sent: Thursday, March 01, 2012 8:11 AM
> To: r-help@r-project.org
> Subject: [R] Delete rows from data.frame matching a certain criteria
>
> Hel
Your criteria did not make sense since in both cases pattern == 1, so
I chose to set to NA if pattern == 1
> test <- data.frame(n = c(1,2,3,4,5), v = c(6,5,7,5,3), pattern =
+ c(1,1,NA,1,NA))
> test
n v pattern
1 1 6 1
2 2 5 1
3 3 7 NA
4 4 5 1
5 5 3 NA
> # set v to NA
Hi,
On Thu, Mar 1, 2012 at 11:11 AM, mails wrote:
> Hello,
>
>
> consider the following data.frame:
>
> test <- data.frame(n = c(1,2,3,4,5), v = c(6,5,7,5,3), pattern =
> c(1,1,NA,1,NA))
>
>> test
> n v pattern
> 1 1 6 1
> 2 2 5 1
> 3 3 7 NA
> 4 4 5 1
>
Hello,
consider the following data.frame:
test <- data.frame(n = c(1,2,3,4,5), v = c(6,5,7,5,3), pattern =
c(1,1,NA,1,NA))
> test
n v pattern
1 1 6 1
2 2 5 1
3 3 7 NA
4 4 5 1
5 5 3 NA
I tried to use apply and the adply function to set v t
8 matches
Mail list logo