Multi-column selection in R

In R, we specify the multiple columns to select by stating them in a vector within square brackets:

    >stocks_table[c('Symbol','Price')]
    Symbol  Price
    1   GOOG 518.70
    2   AMZN 307.82
    3     FB  74.90
    4   AAPL 109.70
    5   TWTR  37.10
    6   NFLX 334.48
    7  LINKD 219.90
    
    >stocks_table[,c('Symbol','Price')]
    Symbol  Price
    1   GOOG 518.70
    2   AMZN 307.82
    3     FB  74.90
    4   AAPL 109.70
    5   TWTR  37.10
    6   NFLX 334.48
    7  LINKD 219.90
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset