Dear Jacy,
As Jorge said.
To clarify : what you ask, is actually to compare the first element of
genotype with the first element of FREQ, the second of genotype with the
second of FREQ and so on. If the lengths differ, the shorter vector is
recycled. This toy example illustrates that principle :
> test1 <- c("a","b","c")
> test2 <- c("a", "c", "b")
> test3 <- c("c","a","b")
> test4=rep("c",6)
> test1 == test2
[1] TRUE FALSE FALSE (only a is found in the same position)
> test1 == test3
[1] FALSE FALSE FALSE
> test1==test4
[1] FALSE FALSE TRUE FALSE FALSE TRUE (test1 is used twice)
Welcome to the wonderful world of R :-)
Kind regards
Joris
On Wed, Mar 25, 2009 at 8:57 PM, Jorge Ivan Velez
wrote:
> Dear Jacy,
> Try this:
>
> colnames(FREQ) %in% colnames(genotype)
>
> See ?"%in%" for details. Also, take a look at also ?match.
>
> HTH,
>
> Jorge
>
>
> On Wed, Mar 25, 2009 at 3:49 PM, Crosby, Jacy R
> wrote:
>
> > What am I missing here? Both of my column headers in the 'FREQ' table are
> > found in the 'genotype'; however, they aren't being recognized.
> >
> > > colnames(FREQ)
> > [1] "X17362526" "X17362627"
> >
> > > colnames(genotype)
> > [1] "X17362311" "X17362316" "X17362346" "X17362420" "X17362421"
> > "X17362422" "X17362435" "X17362438" "X17362459"
> > [10] "X17362488" "X17362493" "X17362526" "X17362542" "X17362565"
> > "X17362566" "X17362581" "X17362594" "X17362605"
> > [19] "X17362627" "X17362642" "X17363363" "X17363364" "X17363388"
> > "X17363389" "X17363404" "X17363410"
> >
> > > colnames(genotype)==colnames(FREQ)
> > [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> > FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> > [19] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> >
> >
> >
> > [[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.
> >
>
> [[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.
>
[[alternative HTML version deleted]]