saving . . . saved Indexing and extracting data has been deleted. Indexing and extracting data has been hidden .
Indexing and extracting data
Title
Question
Dear Team ,
What should be the syntax when we apply 2 conditions at a time like >20 matches played and less than 14 matches lost ?On writing below commands-
print(subData)
subData<-subset(Newcaptaincy,played>20,lost<14,select=c("names","played","lost"))
print(subData)

Answer is
print(subData)
   names played won
1  Dhoni     45  22
2 Sourav     47  20
3  Azhar     40  20




R Indexing-and-Slicing-Data-Frames 11-12 min 0-10 sec 07-12-20, 2:22 p.m. Joohi

Answers:

Simply use an '&' in-between the two conditions as subData<-subset(Newcaptaincy,played>20&lost<14,select=c("names","played","lost"))
10-12-20, 11:37 a.m. chrl3hr5@gmail.com


Thanks .
I get confused whether to View(subset) or just write above command or print(subset).
How to know which command will execute on it's own and which will need a print command or a view command ?
14-12-20, 1:26 p.m. Joohi


Log-in to answer to this question.