zoukankan      html  css  js  c++  java
  • cbind&rbind

    Combine R Objects by Rows or Columns

    Package:
    base

    Take a sequence of vector, matrix or data frames arguments and combine by columns or rows, respectively. These are generic functions with methods for other R classes.

    Usage

    cbind(..., deparse.level = 1)
    rbind(..., deparse.level = 1)
    > m<-cbind(1,1:7) # the '1' (= shorter vector) is recycled
     > m     
        [,1] [,2]
    [1,] 1 1
    [2,] 1 2
    [3,] 1 3
    [4,] 1 4
    [5,] 1 5
    [6,] 1 6
    [7,] 1 7
    > m<-cbind(m,8:14)[,c(1,3,2)]# insert a column中间列,次序是1,3,2 
    > m
        [,1] [,2] [,3]
    [1,] 1 8 1
    [2,] 1 9 2
    [3,] 1 10 3
    [4,] 1 11 4
    [5,] 1 12 5
    [6,] 1 13 6
    [7,] 1 14 7
    > rbind(1,1:4)      
        [,1] [,2] [,3] [,4]
    [1,] 1 1 1 1
    [2,] 1 2 3 4
  • 相关阅读:
    进程总结
    三大流程
    canvas简介
    时钟
    vim
    马拉车
    模拟退火
    洛谷P2055假期的宿舍
    洛谷P2320鬼谷子的钱袋.
    洛谷P2278操作系统
  • 原文地址:https://www.cnblogs.com/blueicely/p/2817822.html
Copyright © 2011-2022 走看看