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
Answers:
Simply use an '&' in-between the two conditions as subData<-subset(Newcaptaincy,played>20&lost<14,select=c("names","played","lost"))
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 ?
Login to add comment