Thans Richard, it works well. --- Kai
On Monday, December 13, 2021, 04:00:33 AM PST, Richard O'Keefe
wrote:
You want to DELETE rows satisfying the condition P & Q.The subset() function
requires an expression saying whatyou want to RETAIN, so you need subset(PD,
!(P & Q)).
test <- subs
You want to DELETE rows satisfying the condition P & Q.
The subset() function requires an expression saying what
you want to RETAIN, so you need subset(PD, !(P & Q)).
test <- subset(PD, !(Class == "1st" & Survived == "No"))
By de Morgan's laws, !(P & Q) is the same as (!P) | (!Q)
so you could als
Use one ampersand, not two.
And post plain text.
On December 12, 2021 8:30:11 PM PST, Kai Yang via R-help
wrote:
>Hi R team,I want to delete records from a data frame if Class = '1st' and
>Survived = 'No'. I wrote the code below, test <- subset(PD, Class != '1st' &&
>Survived != 'No')
>but th
Hi R team,I want to delete records from a data frame if Class = '1st' and
Survived = 'No'. I wrote the code below, test <- subset(PD, Class != '1st' &&
Survived != 'No')
but the code return a wrong result. Can someone help me for this?
Thanks,Kai
[[alternative HTML version deleted]]
___
4 matches
Mail list logo