> Here's another R-way:
>
> > lets<-factor(c( 'A', 'B', 'A', 'C', 'B', 'D', 'B'))
> # you did say they were factors, right?
> > nums <- factor(c('1', '2', '2', '3', '2', '2', '3'))
> > lets=="B"
> [1] FALSE TRUE FALSE FALSE TRUE FALSE TRUE
> > sum(lets=="B" & nums=="2")
> [1] 2
Thanks very much, it will save me :^)
As I am a beginner in R, I have a little trouble understanding factors. Can
they be used interchangeably with lists, or are they a different data-type?
Can I do on factors everything that I can do on lists?
Thanks again!
--
Fabrice DELENTE
______________________________________________
[email protected] 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.