R: What's the easiest way to print out pairs of values from a data.frame?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-21T21:44:09Z Indexed on 2010/03/21 21:51 UTC
Read the original article Hit count: 291

Filed under:
|
|

I have a data.frame:

df<-data.frame(a=c("x","x","y","y"),b=c(1,2,3,4))

> df
      a b
    1 x 1
    2 x 2
    3 y 3
    4 y 4

What's the easiest way to print out each pair of values as a list of strings like this:

"x1", "x2", "y1", "y2"

© Stack Overflow or respective owner

Related posts about r

    Related posts about data.frame