Dear R-help,

My dataset (which is a data frame, called 'Calender' here)  includes 365
rows representing 365 days for a year.  One column ('Season')contains
factor data representing seasons, e.g. spring, summer, autumn and winter.
Another column (called 'Day') contains data representing wether the day  is
a working day  (I use 'Wd' for short here)or weekend (I use 'Wkend' for
short here).


I want to seperate the index of the working days  and weekends for each
season. I used R commend "which" before for one criteria, for example, if I
use...


WdIndex<-which(Calender$Day=='Wd')

that will gives a set of indeices of working days in the year.

I wonder in R could I use a combination of something such as 'AND' , 'OR'
(e.g. in MySQL) to set 'multi-criteria'  when selecting data. So for
example...

WinterWdIndex<-which(Calender$Day=='Wd' AND Calender$Season=="Winter")


I know the above syntax is wrong, and I checked '?which' which did not give
me an answer and also tried '?AND' but seems it doesn`t exist at all...


Many thanks!
HJ

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to