<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 陣列 ### 利用 rbind、cbind 與 array 函數建立陣列 陣列可視為多維度的向量變數,跟向量一樣,所有陣列元素的資料屬性必須一致。 ~~~ > x <- c(1, 2, 3) > y <- c(4, 5, 6) > rbind(x, y) # rbind 是利用 row(橫) 合併。 [,1] [,2] [,3] x 1 2 3 y 4 5 6 > cbind(x, y) # cbind 是利用 column(直) 合併。 x y [1,] 1 4 [2,] 2 5 [3,] 3 6 > array(x,c(1,3)) # c(1,3) 代表產生 1 x 3 陣列 [,1] [,2] [,3] [1,] 1 2 3 > array(x,c(2,3)) # c(2,3) 代表產生 2 x 3 陣列 [,1] [,2] [,3] [1,] 1 3 2 [2,] 2 1 3 > array(x,c(3,3)) # c(3,3) 代表產生 3 x 3 陣列 [,1] [,2] [,3] [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 ~~~ ### 透過指標提取資料 陣列與向量相同,可以透過指標或名稱選取陣列的元素。 ~~~ > x <- c(1, 2, 3) > y <- c(4, 5, 6) > z = rbind(x, y) > z [,1] [,2] [,3] x 1 2 3 y 4 5 6 > z[,1] # 選取第一行(column、直) x y 1 4 > z[1,] # 選取第一列(row、橫) [1] 1 2 3 > z[1,1:2] # 選取第一列第一到二行 [1] 1 2 ~~~ ### 基本相關函數 - 陣列加減乘除 - length:計算陣列中的所有元素個數。 - dim:列出維度資訊 - ncol、nrow:計算(column、直) 或 (row、橫) 個數。 - aperm:將陣列轉置 ~~~ > x <- c(1, 2, 3) > y <- c(4, 5, 6) > z = rbind(x, y) > z [,1] [,2] [,3] x 1 2 3 y 4 5 6 > z + z [,1] [,2] [,3] x 2 4 6 y 8 10 12 > z - 2*z [,1] [,2] [,3] x -1 -2 -3 y -4 -5 -6 > z * z # 相對應的陣列元素相乘 [,1] [,2] [,3] x 1 4 9 y 16 25 36 > z / z # 相對應的陣列元素相除 [,1] [,2] [,3] x 1 1 1 y 1 1 1 > length(z) [1] 6 > dim(z) # 前者是 row,後者是 column。 [1] 2 3 > ncol(z) [1] 3 > nrow(z) [1] 2 > aperm(z) # 等同是從 rbind 轉成 cbind x y [1,] 1 4 [2,] 2 5 [3,] 3 6 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看